Previous Topic

Next Topic

Book Contents

Book Index

Rule JSON Scheme

                                              

            "$schema":"http://json-schema.org/draft-04/schema#",

  "title":"Automation Rule Definitions",

  "description":"This schema is used for verification of JSON definitions used for creation of Automation Rules.",

    "oneOf":[

      {

        "type":"object",

        "title":"Rule",

        "description":"Rule JSON Definition",

        "additionalProperties":false,

        "required":[

          "triggers",

          "flow"

        ],

        "properties":{

          "name":{

            "type":"string",

            "title":"Rule name",

            "description":"Short (one word) user friendly name of the Rule."

          },

          "uid":{

            "type":"string",

            "pattern":"[A-Za-z0-9_-]*",

            "title":"Rule UID",

            "description":"An unique identifier of the Rule in scope of the Rule Engine."

          },

          "tags":{

            "type":"array",

            "title":"Rule Tags",

            "description":"Non-hierarchical keywords or terms describing the Rule. They help to classify the rules and allow them to be found.",

            "minItems":1,

            "items":{

              "type":"string",

              "title":"Tag",

              "description":"Keyword or term describing the Rule."

            }

          },

          "description":{

            "type":"string",

            "title":"Rule Description",

            "description":"A brief description of what the rule is and for what it is used."

          },

          "triggers":{

            "type":"array",

            "minItems":1,

            "title":"Trigger Instructions",

            "description":"Contains definitions of the Trigger Instructions of the Rule.",

            "items":{

              "type":"object",

              "title":"Trigger Instruction",

              "description":"Defines the fact which triggers the Rule execution.",

              "additionalProperties":false,

              "required":[

                "id",

                "handlerUID"

              ],

              "properties":{

                "id":{

                  "type":"string",

                  "pattern":"[a-zA-Z0-9._-]+",

                  "title":"Trigger ID",

                  "description":"Identifies uniquely the trigger in scope of the rule."

                },

                "name":{

                  "type":"string",

                  "title":"Trigger Name",

                  "description":"Short human-readable name of the trigger."

                },

                "description":{

                  "type":"string",

                  "title":"Trigger Description",

                  "description":"A brief description of what the trigger is and for what it is used."

                },

                "handlerUID":{

                  "type":"string",

                  "pattern":"[a-zA-Z0-9._-]+",

                  "title":"Trigger Handler Factory UID",

                  "description":"Identifies the handler factory used for creation of the trigger handler."

                },

                "bindings":{

                  "type":"array",

                        "minItems":1,

                  "title":"Trigger Input Bindings",

                  "description":"Used to define the sources for the input values of the trigger handler.",

                  "items":{

                    "type":"object",

                    "title":"Trigger Input Binding",

                    "description":"Defines the source from which an instruction input data should come from.",

                    "additionalProperties":false,

                    "required":[

                      "id",

                      "type",

                      "source"

                    ],

                    "enum":[

                      "CONSTANT",

                      "INSTRUCTION",

                      "SYSTEM",

                      "VARIABLE"

                    ],

                    "properties":{

                      "id":{

                        "type":"string",

                        "pattern":"[a-zA-Z0-9._-]+",

                        "title":"Binding ID",

                        "description":"Identifies uniquely the binding in scope of the instruction."

                      },

                      "type":{

                        "type":"string",

                        "title":"Binding Type",

                        "description":"Defines the type of the source that will feed with value the binding."

                      },

                      "source":{

                        "type":"string",

                        "title":"Binding Source",

                        "description":"Defines the source that will feed with value the binding."

                      }

                    }

                  }

                }

              }

            }

          },

          "flow":{

            "type":"array",

            "minItems":1,

            "title":"Instructions",

            "description":"Contains definitions of Action and Condition Instructions of the Rule.",

            "items":{

              "type":"object",

              "title":"Instruction",

              "description":"Defines a Condition to be checked or an Action which has to be executed by the Rule.",

              "additionalProperties":false,

              "required":[

                "id",

                "handlerUID"

              ],

              "properties":{

                "id":{

                  "type":"string",

                  "pattern":"[a-zA-Z0-9._-]+",

                  "title":"Instruction ID",

                  "description":"Identifies uniquely the Instruction in scope of the Rule."

                },

                "name":{

                  "type":"string",

                  "title":"Instruction Name",

                  "description":"Short user friendly name of the Instruction."

                },

                "description":{

                  "type":"string",

                  "title":"Instruction Description",

                  "description":"A brief description of what the Instruction is and for what it is used."

                },

                "handlerUID":{

                  "type":"string",

                  "pattern":"[a-zA-Z0-9._-]+",

                  "title":"Instruction Handler UID",

                  "description":"Identifies the Handler used for processing the Instruction."

                },

                "bindings":{

                  "type":"array",

                        "minItems":1,

                  "title":"Instruction Input Bindings",

                  "description":"Used to define the sources for the input values of the handler.",

                  "items":{

                    "type":"object",

                    "title":"Instruction Input Binding",

                    "description":"Defines the source from which an instruction input data should come from.",

                    "additionalProperties":false,

                    "required":[

                      "id",

                      "type",

                      "source"

                    ],

                    "enum":[

                      "CONSTANT",

                      "INSTRUCTION",

                      "SYSTEM",

                      "VARIABLE"

                    ],

                    "properties":{

                      "id":{

                        "type":"string",

                        "pattern":"[a-zA-Z0-9._-]+",

                        "title":"Binding ID",

                        "description":"Identifies uniquely the binding in scope of the instruction."

                      },

                      "type":{

                        "type":"string",

                        "title":"Binding Type",

                        "description":"Defines the type of the source that will feed with value the binding."

                      },

                      "source":{

                        "type":"string",

                        "title":"Binding Source",

                        "description":"Defines the source that will feed with value the binding."

                      }

                    }

                  }

                }

              }

            }

          }

        }

      },

      {

        "type":"object",

        "title":"Rule",

        "description":"Rule JSON Definition",

        "additionalProperties":false,

        "required":[

          "templateUID"

        ],

        "properties":{

          "name":{

            "type":"string",

            "title":"Rule name",

            "description":"Short user friendly name of the Rule."

          },

          "uid":{

            "type":"string",

            "pattern":"[a-zA-Z0-9._-]+",

            "title":"Rule UID",

            "description":"An unique identifier of the Rule in scope of the Rule Engine."

          },

          "templateUID":{

            "type":"string",

            "pattern":"[a-zA-Z0-9._-]+",

            "title":"Template UID",

            "description":"Used for description of the Rule. It must be unique in scope of Template Registry."

          },

          "tags":{

            "type":"array",

            "title":"Rule Tags",

            "description":"Non-hierarchical keywords or terms describing the Rule. They help to classify the rules and allow them to be found.",

            "minItems":1,

            "items":{

              "type":"string",

              "title":"Tag",

              "description":"Keyword or term describing the Rule."

            }

          },

          "description":{

            "type":"string",

            "title":"Rule Description",

            "description":"A brief description of what the rule is and for what it is used."

          },

          "configuration":{

            "type":"object",

            "title":"Rule Configuration",

            "description":"Used to define values of the variables of the Rule."

          }

        }

      },

      {

        "type":"array",

        "minItems":1,

        "items":{

          "oneOf":[

            {

            "type":"object",

            "title":"Rule",

            "description":"Rule JSON Definition",

            "additionalProperties":false,

            "required":[

              "triggers",

              "flow"

            ],

            "properties":{

              "name":{

                "type":"string",

                "title":"Rule name",

                "description":"Short (one word) user friendly name of the Rule."

              },

              "uid":{

                "type":"string",

                "pattern":"[A-Za-z0-9_-]*",

                "title":"Rule UID",

                "description":"An unique identifier of the Rule in scope of the Rule Engine."

              },

              "tags":{

                "type":"array",

                "title":"Rule Tags",

                "description":"Non-hierarchical keywords or terms describing the Rule. They help to classify the rules and allow them to be found.",

                "minItems":1,

                "items":{

                  "type":"string",

                  "title":"Tag",

                  "description":"Keyword or term describing the Rule."

                }

              },

              "description":{

                "type":"string",

                "title":"Rule Description",

                "description":"A brief description of what the rule is and for what it is used."

              },

              "triggers":{

                "type":"array",

                "minItems":1,

                "title":"Trigger Instructions",

                "description":"Contains definitions of the Trigger Instructions of the Rule.",

                "items":{

                  "type":"object",

                  "title":"Trigger Instruction",

                  "description":"Defines the fact which triggers the Rule execution.",

                  "additionalProperties":false,

                  "required":[

                    "id",

                    "handlerUID"

                  ],

                  "properties":{

                    "id":{

                      "type":"string",

                      "pattern":"[a-zA-Z0-9._-]+",

                      "title":"Trigger ID",

                      "description":"Identifies uniquely the trigger in scope of the rule."

                    },

                    "name":{

                      "type":"string",

                      "title":"Trigger Name",

                      "description":"Short human-readable name of the trigger."

                    },

                    "description":{

                      "type":"string",

                      "title":"Trigger Description",

                      "description":"A brief description of what the trigger is and for what it is used."

                    },

                    "handlerUID":{

                      "type":"string",

                      "pattern":"[a-zA-Z0-9._-]+",

                      "title":"Trigger Handler Factory UID",

                      "description":"Identifies the handler factory used for creation of the trigger handler."

                    },

                    "bindings":{

                      "type":"array",

                      "minItems":1,

                      "title":"Trigger Input Bindings",

                      "description":"Used to define the sources for the input values of the trigger handler.",

                      "items":{

                        "type":"object",

                        "title":"Trigger Input Binding",

                        "description":"Defines the source from which an instruction input data should come from.",

                        "additionalProperties":false,

                        "required":[

                          "id",

                          "type",

                          "source"

                        ],

                        "enum":[

                          "CONSTANT",

                          "INSTRUCTION",

                          "SYSTEM",

                          "VARIABLE"

                        ],

                        "properties":{

                          "id":{

                            "type":"string",

                            "pattern":"[a-zA-Z0-9._-]+",

                            "title":"Binding ID",

                            "description":"Identifies uniquely the binding in scope of the instruction."

                          },

                          "type":{

                            "type":"string",

                            "title":"Binding Type",

                            "description":"Defines the type of the source that will feed with value the binding."

                          },

                          "source":{

                            "type":"string",

                            "title":"Binding Source",

                            "description":"Defines the source that will feed with value the binding."

                          }

                        }

                      }

                    }

                  }

                }

              },

              "flow":{

                "type":"array",

                "minItems":1,

                "title":"Instructions",

                "description":"Contains definitions of Action and Condition Instructions of the Rule.",

                "items":{

                  "type":"object",

                  "title":"Instruction",

                  "description":"Defines a Condition to be checked or an Action which has to be executed by the Rule.",

                  "additionalProperties":false,

                  "required":[

                    "id",

                    "handlerUID"

                  ],

                  "properties":{

                    "id":{

                      "type":"string",

                      "pattern":"[a-zA-Z0-9._-]+",

                      "title":"Instruction ID",

                      "description":"Identifies uniquely the Instruction in scope of the Rule."

                    },

                    "name":{

                      "type":"string",

                      "title":"Instruction Name",

                      "description":"Short user friendly name of the Instruction."

                    },

                    "description":{

                      "type":"string",

                      "title":"Instruction Description",

                      "description":"A brief description of what the Instruction is and for what it is used."

                    },

                    "handlerUID":{

                      "type":"string",

                      "pattern":"[a-zA-Z0-9._-]+",

                      "title":"Instruction Handler UID",

                      "description":"Identifies the Handler used for processing the Instruction."

                    },

                    "bindings":{

                      "type":"array",

                      "minItems":1,

                      "title":"Instruction Input Bindings",

                      "description":"Used to define the sources for the input values of the handler.",

                      "items":{

                        "type":"object",

                        "title":"Instruction Input Binding",

                        "description":"Defines the source from which an instruction input data should come from.",

                        "additionalProperties":false,

                        "required":[

                          "id",

                          "type",

                          "source"

                        ],

                        "enum":[

                          "CONSTANT",

                          "INSTRUCTION",

                          "SYSTEM",

                          "VARIABLE"

                        ],

                        "properties":{

                          "id":{

                            "type":"string",

                            "pattern":"[a-zA-Z0-9._-]+",

                            "title":"Binding ID",

                            "description":"Identifies uniquely the binding in scope of the instruction."

                          },

                          "type":{

                            "type":"string",

                            "title":"Binding Type",

                            "description":"Defines the type of the source that will feed with value the binding."

                          },

                          "source":{

                            "type":"string",

                            "title":"Binding Source",

                            "description":"Defines the source that will feed with value the binding."

                          }

                        }

                      }

                    }

                  }

                }

              }

            }

          },

          {

            "type":"object",

            "title":"Rule",

            "description":"Rule JSON Definition",

            "additionalProperties":false,

            "required":[

              "templateUID"

            ],

            "properties":{

              "name":{

                "type":"string",

                "title":"Rule name",

                "description":"Short user friendly name of the Rule."

              },

              "uid":{

                "type":"string",

                "pattern":"[a-zA-Z0-9._-]+",

                "title":"Rule UID",

                "description":"An unique identifier of the Rule in scope of the Rule Engine."

              },

              "templateUID":{

                "type":"string",

                "pattern":"[a-zA-Z0-9._-]+",

                "title":"Template UID",

                "description":"Used for description of the Rule. It must be unique in scope of Template Registry."

              },

              "tags":{

                "type":"array",

                "title":"Rule Tags",

                "description":"Non-hierarchical keywords or terms describing the Rule. They help to classify the rules and allow them to be found.",

                "minItems":1,

                "items":{

                  "type":"string",

                  "title":"Tag",

                  "description":"Keyword or term describing the Rule."

                }

              },

              "description":{

                "type":"string",

                "title":"Rule Description",

                "description":"A brief description of what the rule is and for what it is used."

              },

              "configuration":{

                "type":"object",

                "title":"Rule Configuration",

                "description":"Used to define values of the variables of the Rule."

              }

            }

          }

        ]

      }

    }

  ]

}

See also