Skip to content

rule not validated when property is not present at all #1686

Description

@flx-sta

Describe the bug
rules with the schema {const: null} don't validate successfully when the respective property doesn't exist

To Reproduce
Steps to reproduce the behavior:

  1. check out this repo on the specific branch: https://github.com/Felix-Puetz/jsonforms-vue-example/tree/bug/const-null-returns-true-on-empty-object
  2. run npm install in it
  3. run npm run serve in it
  4. launch the given url in your browser

Example schema:

{
  type: "object",
  properties: {
    name: { type: "string" },
    mail: { type: "string" },
  },
  required: ["name", "mail"],
};

Example uischema:

{
  type: "VerticalLayout",
  elements: [
    {
      scope: "#/properties/name",
      type: "Control",
    },
    {
      scope: "#/properties/mail",
      type: "Control",
      rule: {
        condition: {
          scope: "#/properties/name",
          schema: {
              const: null
          },
        },
        effect: "DISABLE",
      },
    },
  ]
}

Expected behavior
mail field should be disabled when name is not present in data

Screenshots

image

Browser (please complete the following information):

  • Browser all (latest release)

Used Setup (please complete the following information):
All info present in my repository

Additional context
spoke to @sdirix and he confirmed

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions