json-schema-form/angular-schema-form

version(0.8.14) regression in conditional array validation

rthaut opened this issue · 3 comments

This appears to be a new bug introduced in version 0.8.14.

Basically, if you have an array property in your schema, and that property is conditional, the form is not being validated correctly.

Here is a reduced example showing it working with version 0.8.13.

Here is the exact same example NOT working with version 0.8.14.

In both examples, if you check the "Show Array Elements" checkbox, the array section appears. If you provide at least a value for Field 1 and submit, the form validates for 0.8.13, but not for 0.8.14.

In 0.8.14, the form has the following $error:

"$error": {
  "schemaForm": [
    {
      "$viewValue": [
        {
          "Field1": "My Test Value for Field1"
        }
      ],
      "$modelValue": [
        {
          "Field1": "My Test Value for Field1"
        }
      ],
      "$validators": {},
      "$asyncValidators": {},
      "$parsers": [
        null
      ],
      "$formatters": [
        null
      ],
      "$viewChangeListeners": [],
      "$untouched": true,
      "$touched": false,
      "$pristine": false,
      "$dirty": true,
      "$valid": false,
      "$invalid": true,
      "$error": {
        "schemaForm": true
      },
      "$name": "",
      "$options": {}
    }
  ]
}

@json-schema-form/angular-schema-form-lead

@rthaut wow, that's an interesting case. No doubt plenty of users have it. Thanks for the demos, it does seem related to the condition as removing the condition it works in both, I suspect it was related to some fo the array changes that went into the branch mid last year.

@rthaut can you test again with the bootstrap decorator from 0.8.13 with ASF 0.8.14? I think it just included a version of the decorator too new for the code in ASF.

@Anthropic Using the Bootstrap Decorator from 0.8.13 with ASF 0.8.14 does indeed work correctly, at least for this scenario. Here's a demo: https://codepen.io/rthaut/full/qMWpaV/