eclipsesource / eclipsesource/jsonforms

Using "#" as the scope in a rule condition always evaluates to true.

Open
#2,141 3 comments 1 reaction 0 assignees View on GitHub
more information required
Dominant language
TypeScript
Stars
2.7k
Forks
424
Avg merge
17d 8h
Merged PRs (30d)
1

Description

### Describe the bug

If, in a rule condition, I use `"#"` as the `scope`, `resolveData` will resolve to `undefined` instead of the `data` itself, so `evaluateCondition` will always return `true`.

### Expected behavior

Using `"#"` as the scope should evaluate `condition.schema` on the value of `data`.

### Steps to reproduce the issue


  1. Have a rule in your uischema with `"#"` as the scope of the condition

    ```json
    {
    "type": "Control",
    "scope": "#/properties/someObj",
    "rule": {
    "effect": "SHOW",
    "condition": {
    "scope": "#",
    "schema": {
    "properties": {
    "someProp": { "const": "someValue" }
    }
    }
    }
    }
    }
    ```


  2. The control should only be visible when `someObj.someProp` equals `"someValue"`, but it always renders.


### Screenshots

_No response_

### In which browser are you experiencing the issue?

Chrome/113.0.0.0

### Which Version of JSON Forms are you using?

3.0.0

### Framework

React

### RendererSet

Vanilla

### Additional context

The only way I could get `isVisible` to return `false` is to hard-code an empty string for the `path` argument.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.