remove validation for empty conditions

This commit is contained in:
Peter Clement 2024-10-31 11:43:15 +00:00
parent dd9057169f
commit d37c3ab99f
2 changed files with 2 additions and 26 deletions

View File

@ -173,30 +173,6 @@ describe("/automations", () => {
})
})
it("Should check validation on a branch step with empty conditions", async () => {
const automation = createAutomationBuilder({
name: "String Equality Branching",
appId: config.getAppId(),
})
.appAction({ fields: { status: "active" } })
.branch({
activeBranch: {
steps: stepBuilder =>
stepBuilder.serverLog({ text: "Active user" }),
condition: {},
},
})
.build()
await config.api.automation.post(automation, {
status: 400,
body: {
message:
'Invalid body - "definition.steps[0].inputs.branches[0].condition" must have at least 1 key',
},
})
})
it("Should check validation on an branch that has a condition that is not valid", async () => {
const automation = createAutomationBuilder({
name: "String Equality Branching",

View File

@ -280,8 +280,8 @@ function generateStepSchema(allowStepTypes: string[]) {
const branchSchema = Joi.object({
id: Joi.string().required(),
name: Joi.string().required(),
condition: filterObject({ unknown: false }).required().min(1),
conditionUI: Joi.object(),
condition: filterObject({ unknown: false }).required().allow(null),
conditionUI: Joi.object().allow(null),
})
return Joi.object({