Possible issue with rules: failure when dealing with scope depths greater than one

I’m using react with JSONForms and ran into an issues with the use of rules. I do not know if that is the correct behavior or not, because the documentation on rules does not say anything about the field’s scope depth limitations that the rule is attached to.

I’m using the following versions, of which I was also having the same issues when using beta.0 too.

 "@jsonforms/core": "^3.2.0-beta.1",
 "@jsonforms/material-renderers": "^3.2.0-beta.1",
 "@jsonforms/react": "^3.2.0-beta.1",

The problem that I’m running in to, is that the rule for DISABLE is non-functional when using it in this form where the scope is greater than one level deep. What I mean by non-functional, is that the field is always editable.

{                                    
    "type": "Control",
    "label": "Sequencing method ontology label",
    "scope": "#/properties/method/properties/ontology_label",
    "rule": {
        "effect": "DISABLE",
        "condition": {}
   }
}

But the rule works if adding the following complexity to force the rule to act over a Control that has a scope depth of only one level deep.

{                                    
    "type": "Control",
    "scope": "#/properties/method",
    "options": {
        "detail": {
            "type": "Control",
            "label": "Sequencing method ontology label",
            "scope": "#/properties/ontology_label",
            "rule": {
                "effect": "DISABLE",
                "condition": {}
            }
        }
    }
}

The inner schema can be found here, of which is a bit too large to post inline (or at least I feel as such):
Sequencing Method Ontology

Before changing a ton of UI schemas, I was wondering if I am doing something wrong, or if this is the intended behavior of scope-rules, where it can only have a depth of one, and therefore it must be wrapped within an options-detail structure?

I’ve noticed there is an issue with SHOW rules too, but have not really confirmed if it’s a depth issue related to the fields scope yet. I will check and see if it’s related to the scope’s depth when I get a chance later.

Thanks greatly for your help!

Hi @rbluer,

Is #/properties/method of type object or of type array? If it is an object, I would expect the rule to work. If it is an array, then it can’t work as the scope can’t refer to a specific index in the data.

It would be best if you could post a full JSON Schema and UI Schema to reproduce the issue, as it gives more context and allows us to more easily reproduce the problem.

Ok, thanks for the reply. It’s an object, but let me see if I can put together a working demo showing the issue that I’m seeing. It may take a little while to get that all pulled together. I might be able to get it done over the weekend.