Multiple if then statements in an allOf

Hi All,

I’m using material react json forms version 3.0.0-alpha. I have multiple if then else statements wrapped in an allOf array. my if then else statements are mainly to validate that if one field is populated then another field must also be populated e.g:

			"allOf": [
				{
					"if": {
						"properties": {
							"dataType": {
								"const": "STRING"
							}
						},
						"required": ["dataType"]
					},
					"then": {
						"required": ["length"]
					}
				},
				{
					"if": {
						"properties": {
							"precision": {
								"pattern": "[0-9]"
							}
						},
						"required": ["precision"]
					},
					"then": {
						"properties": {
							"dataType": {
								"const": "NUMERIC"
							}
						}
					}
				},
				{
					"if": {
						"properties": {
							"scale": {
								"pattern": "[0-9]"
							}
						},
						"required": ["scale"]
					},
					"then": {
						"properties": {
							"dataType": {
								"const": "NUMERIC"
							}
						}
					}
				}
			]

This works fine when being rendered in a Table e.g:

However when the part of the schema to which the allOf statement applies includes a nested object and hence an MaterialArrayLayout would normally be used instead I get the following:

is there anything I can do to add support for the multiple if then else statements on a schema object that contains a nested schema object.

Thanks in advance!

Hi @james-morris,

I see. I’m pretty sure our “nested” array detection logic is very likely not checking the then/else constructs and therefore does not trigger here.

To fix this you can control the type of the array via the UI Schema (i.e. options.detail) or re-register the array layout renderer with a tester which is able to handle your then/else constructs and also applies there.

is it the array layout renderer that is actually the issue here or is it the controls within the array layout renderer? does the fact that i’ve got the accordions that can be opened suggest that it’s the contents that it’s not able to find the renderers for?

I think i’ve traced it down a bit further. I think in the ExpandPanelRenderer the method that get’s the generated uischema returns the following for my object containing the anyOf:

I think this is because of the isCombinator function: