When using the provided json schema https://raw.githubusercontent.com/microsoft/RulesEngine/main/schema/workflow-schema.json within VSCode for json editing, not all samples will be accepted.
The schema expects a single object as root, not an array... meaning following json is invalid:
[
{
"WorkflowName": "NestedInputDemoWorkflow1",
"Rules": [
{
"RuleName": "CheckNestedSimpleProp",
"ErrorMessage": "One or more adjust rules failed.",
"ErrorType": "Error",
"RuleExpressionType": "LambdaExpression",
"Expression": "input1.NestedProp.SimpleProp == \"nestedSimpleProp\""
}
]
},
{
"WorkflowName": "NestedInputDemoWorkflow2",
"Rules": [
{
"RuleName": "CheckNestedListProp",
"ErrorMessage": "One or more adjust rules failed.",
"ErrorType": "Error",
"RuleExpressionType": "LambdaExpression",
"Expression": "input1.NestedProp.ListProp[0].Id == 1 && input1.NestedProp.ListProp[1].Value == \"second\""
}
]
}
]
But this will be marked valid:
{
"WorkFlowName": "Discounts",
"Rules": [
{
"RuleName": "GiveDiscount10",
"SuccessEvent": "10",
"ErrorMessage": "One or more adjust rules failed.",
"ErrorType": "Error",
"RuleExpressionType": "LambdaExpression",
"Expression": "input1.country == \"india\" AND input1.loyaltyFactor <= 2 AND input1.totalPurchasesToDate >= 5000"
},
{
"RuleName": "GiveDiscount20",
"SuccessEvent": "20",
"ErrorMessage": "One or more adjust rules failed.",
"ErrorType": "Error",
"RuleExpressionType": "LambdaExpression",
"Expression": "input1.country == \"india\" AND input1.loyaltyFactor >= 3 AND input1.totalPurchasesToDate >= 10000"
}
]
}
When using the provided json schema
https://raw.githubusercontent.com/microsoft/RulesEngine/main/schema/workflow-schema.jsonwithin VSCode for json editing, not all samples will be accepted.The schema expects a single object as root, not an array... meaning following json is invalid:
But this will be marked valid: