mirror of
https://github.com/zhigang1992/react-jsonschema-form.git
synced 2026-01-12 22:50:02 +08:00
* Inject defaults in arrays
When using dependencies in array items, defaults are now injected.
This adjusts injecting arrays into the form data from defaults to be
in line with the previous behaviour. So the defaults are injected when
there is either no value defined in the form data or when an array is
already set in the form data, injects only into existing entries.
This makes sure that we don't change any existing behaviour by creating
array entries where we did not create them before.
For example for following schema:
{
"type": "array",
"minItems": 2,
"items": {
"title": "asd",
"type": "object",
"properties": {
"item": {
"type": "string",
"default": "foo"
}
}
}
}
and following form data:
[{}]
The result will be (note how it did not full up the array to min items)
[{ "item": "foo" }]
* Remove redundant comment
* Add documentation and example
* Merge arrays defined in parent schema by overwriting same level arrays
* fix typo
* fix typos
* wording changes
Co-Authored-By: Dominik del Bondio <dominik.del.bondio@bitextender.com>