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

Using oneOf does not pass validation to the next step #3828

Closed
4 tasks done
Vity01 opened this issue Aug 15, 2023 · 2 comments
Closed
4 tasks done

Using oneOf does not pass validation to the next step #3828

Vity01 opened this issue Aug 15, 2023 · 2 comments

Comments

@Vity01
Copy link

Vity01 commented Aug 15, 2023

Prerequisites

What theme are you using?

mui

Version

5.x

Current Behavior

Using OneOf is causing multiple validation errors, not just for the form which is actually viewing.
Use this test demo link. Select eg. Kafka from the select box, fill the form and Click on Submit. You will see multiple errors from multiple forms.

Expected Behavior

No validation error for all options.

Steps To Reproduce

Use the demo link mentioned above.

Environment

- OS: All
- Node: 16
- npm:?

Anything else?

No response

@nickgros
Copy link
Contributor

@Vity01 this is not a bug in RJSF. When I click through the repro, I get this data

{
  "detail": {
    "host": "asdasd",
    "port": 123
  },
  "name": "asd"
}

This matches more than one of your schemas in the oneOf, which causes it to fail. I recommend either using anyOf instead of oneOf, or adding a discriminator property that has a unique value for each oneOf schema.

@nickgros nickgros added question awaiting response and removed bug needs triage Initial label given, to be assigned correct labels and assigned labels Aug 18, 2023
@Vity01
Copy link
Author

Vity01 commented Aug 23, 2023

OK, Thank you very much for the analysis. I fix it.

@Vity01 Vity01 closed this as completed Aug 23, 2023
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