Skip to content

schemaForm.merge reports incorrect keys for array object properties #900

Closed
@donalmurtagh

Description

@donalmurtagh

Overview

In the latest version (1.0.0-alpha.5), the schemaForm.merge function reports incorrect keys for object properties stored in an array

Steps to Reproduce

  1. Open this Plunker demo
  2. Click the "Merge form and schema button" and look at the result
  3. In the result section, look at the keys reported for the child's name and age

Name

                "key": [
                  "",
                  0,
                  "peopleLivingWithYou",
                  "dependentChildren",
                  0
                ],

Age

                "key": [
                  "",
                  0,
                  "peopleLivingWithYou",
                  "dependentChildren",
                  0
                ],

Obviously these properties should not have the same key, and name and age should be last elements of the key array.

If you remove the section from the form, i.e. change the form definition to

    $scope.form = [{
        key: 'peopleLivingWithYou.dependentChildren',
        add: "Add Child",
        title: 'Dependent children details',
        validationMessage: 'Complete all required fields for at least one child'
      }];

The keys are correctly reported as

Name

            "key": [
              "peopleLivingWithYou",
              "dependentChildren",
              0,
              "name"
            ],

Age

            "key": [
              "peopleLivingWithYou",
              "dependentChildren",
              0,
              "age"
            ],

This problem does not exist in version 0.8.13.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions