eclipsesource / eclipsesource/jsonforms
required keyword doesn't work with oneOf fields
- Dominant language
- TypeScript
- Stars
- 2.7k
- Forks
- 424
- Avg merge
- 17d 8h
- Merged PRs (30d)
- 1
Description
### 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:
```json
{
"title": "Oratrice",
"type": "object",
"properties": {
"mecanique": {
"title": "Mecanique",
"oneOf": [
{
"title": "d'Analyse",
"type": "string"
},
{
"title": "Cardinale",
"type": "object",
"properties": {
"cardinale": {
"title": "name",
"type": "string"
}
},
"required": ["cardinale"]
}
]
}
},
"required": ["mecanique"]
}
```
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
Contributor guide
Assessment
This issue has not been assessed yet.