-
Notifications
You must be signed in to change notification settings - Fork 421
Description
Describe the bug
I have schema with some group of inputs that shoud appear conditionally. And some of them are required in their groups. So I use combinator allOf to describe 3 different schemas regarding to a value that is present in schema always. And everything is going fine (validation works) except required marker. I use my own renderers set and this marker relies on property required in ControlProps that is false. Probably. it shouldn't work when value change but it also doesn't work from initial.
I can't add field to required array of the whole schema because fields must be required regarding to Select value (dataSource property)
My Schema
{
allOf: [
{
if: {
properties: {
dataSource: {
const: "dictionary",
},
},
},
then: {
required: ["dictionaryName", "dictionaryField"],
},
},
{
if: {
properties: {
dataSource: {
const: "json",
},
},
},
then: {
required: ["json"],
},
},
{
if: {
properties: {
dataSource: {
const: "database",
},
},
},
then: {
required: ["databaseTable", "databaseTableField"],
},
},
],
properties: {
databaseTable: {
type: "string",
},
databaseTableField: {
type: "string",
},
dataSource: {
oneOf: [
{
const: "dictionary",
title: "Dictionaty",
},
{
const: "json",
title: "JSON",
},
{
const: "database",
title: "Database",
},
],
type: "string",
},
dictionaryField: {
type: "string",
},
dictionaryFilter: {
type: "string",
},
dictionaryName: {
type: "string",
},
json: {
type: "string",
},
},
type: "object",
}My UiSchema
{
elements: [
{
options: {
choiceGroup: true,
size: "auto",
},
scope: "#/properties/dataSource",
type: "Control",
},
{
elements: [
{
scope: "#/properties/dictionaryName",
type: "Control",
},
{
scope: "#/properties/dictionaryField",
type: "Control",
},
{
scope: "#/properties/dictionaryFilter",
type: "Control",
}
],
rule: {
condition: {
schema: {
const: "dictionary",
},
scope: "#/properties/dataSource",
},
effect: "SHOW",
},
type: "VerticalLayout",
},
{
rule: {
condition: {
schema: {
const: "json",
},
scope: "#/properties/dataSource",
},
effect: "SHOW",
},
scope: "#/properties/json",
type: "Control",
},
{
elements: [
{
scope: "#/properties/databaseTable",
type: "Control",
},
{
scope: "#/properties/databaseTableField",
type: "Control",
},
],
rule: {
condition: {
schema: {
const: "database",
},
scope: "#/properties/dataSource",
},
effect: "SHOW",
},
type: "VerticalLayout",
},
],
type: "VerticalLayout",
}SandBox with example https://codesandbox.io/p/sandbox/brave-williamson-5ywrhq?file=%2Fsrc%2FApp.js%3A157%2C3
Expected behavior
Property required in ControlProps is true
Steps to reproduce the issue
- Go to example link
- Set value in select
- See validation error, but not marker
Screenshots
No response
Which Version of JSON Forms are you using?
v3.5.0 (but example in 3.7.0)
Package
No response
Additional context
No response