Open DrewHoo opened 1 year ago
Hi @DrewHoo,
Thanks for providing the codesandbox for reproduction. However in general it would be nice to have the reproduction steps self-contained in the issue description too ;) I edited the description to include it.
Our required
analysis is very basic, and we're bailing very fast if conditionals or if
/then
/else
are involved. However here, as the whole oneOf
is required always, we should be able to still determine this.
The code can be found here. Would you like to contribute a fix?
Hi @sdirix,
Yeah, I'll take a look at adding a fix! Thanks for adding the repro steps to the description, will be sure to include the schema here next time =)
Hi, let me add another example for a conditional required field:
The example is missing the asterisk indicator for this case (the renderer field does not get an update required
attribute).
Describe the bug
If you have a oneOf field that contains both object and string type schemas, requiring that field has no effect on the string-type schema, and AFAICT there's no way to make the string-type schema required.
Expected behavior
when requiring a oneOf field that contains multiple schema types, non-object types show up as required.
Steps to reproduce the issue
Used schema:
If a (string) control is rendered for the first entry of the
oneOf
, the JSON Forms bindings will not indicate that this control is required.I created a minimal reproduction in this codesandbox: https://codesandbox.io/p/sandbox/wizardly-darkness-vhrlwt?file=%2Fsrc%2FApp.tsx%3A50%2C27
Screenshots
No response
In which browser are you experiencing the issue?
Firefox 120.0
Which Version of JSON Forms are you using?
v3.1.0
Framework
Core, React
RendererSet
Other (please specify in the Additional context field)
Additional context
This is a bug in either the Core library or the React library--it happens with multiple renderer sets