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

MultiSchemaField getting incorrect id when inside array #2197

Closed
2 of 3 tasks
QingqiShi opened this issue Jan 18, 2021 · 1 comment
Closed
2 of 3 tasks

MultiSchemaField getting incorrect id when inside array #2197

QingqiShi opened this issue Jan 18, 2021 · 1 comment

Comments

@QingqiShi
Copy link

Prerequisites

Description

When MultiSchemaField is part of an array the idSchema is incorrectly generated. This can cause duplicated ids.

Steps to Reproduce

  1. Check packages/core/test/anyOf_test.js
  2. Find the test should correctly render form inputs for anyOf inside array items
  3. Currently we're expecting input#root_foo to exist, but that's not the right id

Expected behavior

The idSchema ids should maintain the full id even if they're inside arrays.

For example, given a schema

const schema = {
  type: "object",
  properties: {
    items: {
      type: "array",
      items: {
        type: "object",
        anyOf: [
          {
            properties: {
              foo: {
                type: "string",
              },
            },
          },
          {
            properties: {
              bar: {
                type: "string",
              },
            },
          },
        ],
      },
    },
  },
};

The id for the foo field within each array item should be root_items_0_foo, root_items_1_foo etc.

Actual behavior

For the example above, the generated id is root_foo for all array items.

Version

2.4.1

@heath-freenome
Copy link
Member

heath-freenome commented Aug 28, 2022

Fixed in v5 beta via #3039, see the 5.x migration guide

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

Successfully merging a pull request may close this issue.

3 participants