guillotinaweb / ngx-schema-form

HTML form generation based on JSON Schema
MIT License
485 stars 174 forks source link

Regression loading array data with v 2.7.0 #426

Open kottle opened 2 years ago

kottle commented 2 years ago

After version: 2.5.9 has been introduced a bug so the library cannot load data from array, the scenario is very simple and reproducible running ngx-schema-form-demo with: sampleschema.json:

{
    "$schema": "http://json-schema.org/draft-04/hyper-schema#",
    "type": "object",
    "properties": {
        "contributors": {
            "description": "Contributors",
            "type": "array",
            "items": {
                "type": "string",
                "widget": {
                    "id": "string"
                }
            }
        }
    }
}

samplemodel.json:

{
    "contributors": [
        "first",
        "second"
    ]
}

The result is an empty array Schermata del 2022-01-12 23-08-16

As suggested in #318 by aderman I locally fixed uncommenting reset in form.component

` if (this.model) {
        // this.rootProperty.reset(this.model, false);
} 

`