Skip to content

Forms rendered with invalid path when scope contains anyOf with 10 or more subschemas #2193

@fuku710

Description

@fuku710

Describe the bug

JSONForms are rendered with invalid path with complex UIschema that contains the scope has anyOf keyword accompany with 10 or more numbers.

For example this JSONSchema and UISchema generate corrupted data value when called handleChange.

JSONSchema:

{
  type: "object",
  properties: {
    foo: {
      anyOf: [
        {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {type: "string" }
      ]
    }
  }
}

UISchema

{
  type: "VerticalLayout",
  elements: [
    {
      type: "Control",
      scope: "#/properties/foo/anyOf/10/"
    }
  ]
}

Result

{"foo":[null,null,null,null,null,null,null,null,null,null,"a"]}

Expected behavior

JSONForms generates correct value when called handleChange.

Expected result

{"foo":"a"}

Steps to reproduce the issue

  1. Access this url https://codesandbox.io/s/goofy-fog-k9n3qv
  2. Type some characters in textbox of B
  3. Print broken values in console log

Screenshots

No response

In which browser are you experiencing the issue?

Google Chrome 118.0.5993.70

Which Version of JSON Forms are you using?

v3.1.0

Framework

React

RendererSet

Vanilla

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions