react-jsonschema-form: oneOf doesn't work with objects

Prerequisites

What theme are you using?

core

Version

5.x

Current Behavior

The form shows wrong error messages in case the schema contains oneOf with objects inside and the user changes between the available options.

The unexpected errors:

  • must NOT have additional properties
  • must match exactly one schema in oneOf

Expected Behavior

The form should work fine with all kinds of oneOf schemas.

Steps To Reproduce

  1. Go to Playground
  2. Enable Live Validation
  3. Select ‘Option 2’
  4. Select ‘Option 1’

Environment

RJSF playground

Anything else?

Screenshot 2023-06-26 at 9 18 22

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 20 (9 by maintainers)

Most upvoted comments

The discriminator provides a performance increase with the oneOf computations

Hi, @heath-freenome - maybe I didn’t notice something, but your link seems to be the same as the first one. The problem is when both branches are objects, like in the link I gave. I paste it again: link It behaves a bit strange: if you play with clicking on reset, validate and changing the option - then sometimes it says ok, sometimes gives errors. To me it seems either a cache like issue, or like the validator wouldn’t fall back from the wrong branch.