diff --git a/apps/api/src/app/workflows-v2/usecases/validate-content/prepare-and-validate-content/prepare-and-validate-content.usecase.ts b/apps/api/src/app/workflows-v2/usecases/validate-content/prepare-and-validate-content/prepare-and-validate-content.usecase.ts index da2b676fb7e..30192eb9814 100644 --- a/apps/api/src/app/workflows-v2/usecases/validate-content/prepare-and-validate-content/prepare-and-validate-content.usecase.ts +++ b/apps/api/src/app/workflows-v2/usecases/validate-content/prepare-and-validate-content/prepare-and-validate-content.usecase.ts @@ -106,13 +106,13 @@ export class PrepareAndValidateContentUsecase { let flatSanitizedControlValues: Record = flattenJson(controlValues); const controlValueToContentIssues: Record = {}; + flatSanitizedControlValues = this.removeEmptyValuesFromMap(flatSanitizedControlValues); this.overloadMissingRequiredValuesIssues( defaultControlValues, flatSanitizedControlValues, controlValueToContentIssues ); - flatSanitizedControlValues = this.removeEmptyValuesFromMap(flatSanitizedControlValues); flatSanitizedControlValues = this.removeIllegalValuesAndOverloadIssues( flatSanitizedControlValues, controlValueToValidPlaceholders, diff --git a/apps/api/src/app/workflows-v2/workflow.controller.e2e.ts b/apps/api/src/app/workflows-v2/workflow.controller.e2e.ts index 657d03db48b..0f7fad4977f 100644 --- a/apps/api/src/app/workflows-v2/workflow.controller.e2e.ts +++ b/apps/api/src/app/workflows-v2/workflow.controller.e2e.ts @@ -223,6 +223,20 @@ describe('Workflow Controller E2E API Testing', () => { } } }); + it('should show control value required when empty', async () => { + const { issues, status } = await createWorkflowAndReturnStepIssues( + { steps: [{ ...buildInAppStep(), controlValues: { body: '' } }] }, + 0 + ); + expect(status, JSON.stringify(issues)).to.equal(WorkflowStatusEnum.ERROR); + expect(issues).to.be.ok; + if (issues.controls) { + expect(issues.controls?.body).to.be.ok; + if (issues.controls?.body) { + expect(issues.controls?.body[0].issueType).to.be.equal(StepContentIssueEnum.MISSING_VALUE); + } + } + }); it('should show digest control value issues when illegal value provided', async () => { const steps = [{ ...buildDigestStep() }];