eclipsesource / jsonforms-react-seed

React-based JSON Forms Seed App

Home Page:https://jsonforms-react-seed.netlify.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Usage of schema based conditions

pragnesh-is opened this issue · comments

Also, there is no examples and documents how to use schema based conditions, please can you provide how to use it with master branch code of this repo.

This worked: "schema": { "enum": ["Never", "Weekly"] }
Documentation error at: https://jsonforms.io/docs/uischema/rules, it says "schema": { enum: ["foo"] }

Is there any other use case of schema in condition ?
How can I use condition against array type ?

The idea of schema based conditions is that you can provide a schema which the data referenced via the scope property will be validated against, i.e. if validation succeeds, the effect will be triggered. So if you want to formulate a condition which checks against a array, all you need to do is to specify the respective schema, e.g. if you want an effect to be triggered whenever an array has at least three items, the condition would look like (#/properties/foo is of type array in this example)

condition: {
  scope: '#/properties/foo',
  schema: {
    minItems: 3
  }
}

I hope this answers your question, if not, please re-open.