Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

version(0.8.14) regression in conditional array validation #986

Open
rthaut opened this issue Aug 13, 2018 · 3 comments
Open

version(0.8.14) regression in conditional array validation #986

rthaut opened this issue Aug 13, 2018 · 3 comments

Comments

@rthaut
Copy link
Contributor

rthaut commented Aug 13, 2018

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

@Anthropic
Copy link
Member

@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.

@Anthropic Anthropic self-assigned this Aug 14, 2018
@Anthropic Anthropic changed the title [0.8.14] Conditional Array Properties are Not Validated Correctly version(0.8.14) regression in conditional array validation Aug 14, 2018
@Anthropic
Copy link
Member

@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.

@rthaut
Copy link
Contributor Author

rthaut commented Aug 19, 2018

@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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants