rjsf-team / react-jsonschema-form

A React component for building Web forms from JSON Schema.
https://rjsf-team.github.io/react-jsonschema-form/
Apache License 2.0
14.3k stars 2.19k forks source link

If else and RJSF rendering issues containing it. #3787

Open Abhishek-kumar09 opened 1 year ago

Abhishek-kumar09 commented 1 year ago

Prerequisites

What theme are you using?

material-ui

Version

5.x

Current Behavior

Here is the playground link

I have bunch of nested if else statements, that should show different options when swicthed to different properties. In short:

Although, the URL is required for the else part, the form still throws validation errors with message must have required property 'url' screenshot: Screenshot 2023-07-25 at 12 22 09 AM

Expected Behavior

Steps To Reproduce

Described above

Environment

- OS: MacOSX
- Node: 16
- npm: 8.19

Anything else?

No response

harkiratsm commented 1 year ago

Related from https://github.com/rjsf-team/react-jsonschema-form/pull/3763 https://github.com/rjsf-team/react-jsonschema-form/pull/3767

^^ @heath-freenome @nickgros

heath-freenome commented 1 year ago

This requires implementing a new feature similar to ui:fieldReplacesAnyOrOneOf except that it would be ui:anyOrOneOfReplacesField. In the SchemaField we render both the field and the anyOf/oneOf. With this flag turned on then I would imagine that the field is not rendered since the anyOfOneOf will do it. This would required some verification of it working properly, including some decent unit tests. We could use some help for this.