Skip to content

Commit 91c3fa6

Browse files
Removed "required" tag from failOnValidationErrors
Signed-off-by: Venera <31911811+venera-program@users.noreply.github.com>
1 parent f50885c commit 91c3fa6

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

model/workflow.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ type DataInputSchema struct {
507507
// +kubebuilder:validation:Required
508508
Schema string `json:"schema" validate:"required"`
509509
// +kubebuilder:validation:Required
510-
FailOnValidationErrors bool `json:"failOnValidationErrors" validate:"required"`
510+
FailOnValidationErrors bool `json:"failOnValidationErrors"`
511511
}
512512

513513
type dataInputSchemaUnmarshal DataInputSchema

model/workflow_validator_test.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,39 @@ Key: 'Workflow.States[3].BaseState.Transition.NextState' Error:Field validation
417417
StructLevelValidationCtx(t, testCases)
418418
}
419419

420+
func TestDataInputSchemaStructLevelValidation(t *testing.T) {
421+
baseWorkflow := buildWorkflow()
422+
423+
operationState := buildOperationState(baseWorkflow, "start state")
424+
buildEndByState(operationState, true, false)
425+
action1 := buildActionByOperationState(operationState, "action 1")
426+
buildFunctionRef(baseWorkflow, action1, "function 1")
427+
428+
testCases := []ValidationCase{
429+
{
430+
Desp: "empty DataInputSchema",
431+
Model: func() Workflow {
432+
model := baseWorkflow.DeepCopy()
433+
model.DataInputSchema = &DataInputSchema{}
434+
return *model
435+
},
436+
Err: `workflow.dataInputSchema.schema is required`,
437+
},
438+
{
439+
Desp: "filled Schema, default failOnValidationErrors",
440+
Model: func() Workflow {
441+
model := baseWorkflow.DeepCopy()
442+
model.DataInputSchema = &DataInputSchema{
443+
Schema: "sample schema",
444+
}
445+
return *model
446+
},
447+
},
448+
}
449+
450+
StructLevelValidationCtx(t, testCases)
451+
}
452+
420453
func TestSecretsStructLevelValidation(t *testing.T) {
421454
baseWorkflow := buildWorkflow()
422455

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy