Files
react-jsonschema-form/test
Ashwin Ramaswami b8276c17ad Inject defaults in arrays (2) (#1499)
* 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>
2019-11-08 17:39:06 -08:00
..
2016-07-05 20:56:23 +02:00
2019-04-12 13:35:05 -07:00
2019-05-24 21:28:19 -07:00