Or

The or condition tests whether at least one of multiple sub-conditions are true. This joins the sub-conditions together in a logical OR.

JSON Schema

{
    "title": "Or",
    "properties": {
        "conditions": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "type": {
                        "type": "string"
                    },
                    "config": {
                        "type": "object"
                    }
                }
            }
        }
    }
}

Example #1

Suppose you wanted a condition to evaluate if:

  • a node has published set to true OR
  • a node's type is my:article

The condition could be written like this:

{
    "type": "or",
    "config": {
        "conditions": [{
            "type": "propertyEquals",
            "config": {
                "property": "published",
                "value": true
            }
        }, {
            "type": "typeEquals",
            "config": {
                "type": "my:article"
            }
        }]
    }

}

Example #2

You can also nest or and and to form composite checks.

Suppose you wanted a condition to evaluate if:

  • a node has published set to true AND the node's type is my:article OR
  • a node has published set to false AND the node's type is my:press-release

The condition could be written like this:

{
    "type": "or",
    "config": {
        "conditions": [{
            "type": "and",
            "config": {
                "conditions": [{
                    "type": "propertyEquals",
                    "config": {
                        "property": "published",
                        "value": true
                    }
                }, {
                    "type": "typeEquals",
                    "config": {
                        "type": "my:article"
                    }
                }]
            }
        }, {
            "type": "and",
            "config": {
                "conditions": [{
                    "type": "propertyEquals",
                    "config": {
                        "property": "published",
                        "value": false
                    }
                }, {
                    "type": "typeEquals",
                    "config": {
                        "type": "my:press-release"
                    }
                }]
            }
        }]
    }
}

Example #3

Here is another nesting example.

Suppose you wanted a condition to evaluate if:

  • a node is published
  • a node's type is either my:article or my:press-release

The condition could be written like this:

{
    "type": "and",
    "config": {
        "conditions": [
            "type": "propertyEquals",
            "config": {
                "property": "published",
                "value": true
            }
        }, {
            "type": "or",
            "config": {
                "conditions": [{
                    "type": "propertyEquals",
                    "config": {
                        "property": "published",
                        "value": false
                    }
                }, {
                    "type": "typeEquals",
                    "config": {
                        "type": "my:press-release"
                    }
                }]
            }
        }]
    }
}