Skip to content

relax state action validation #183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions hack/deepcopy-gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ if [ "${GENS}" = "all" ] || grep -qw "deepcopy" <<<"${GENS}"; then
# for debug purposes, increase the log level by updating the -v flag to higher numbers, e.g. -v 4
"${GOPATH}/bin/deepcopy-gen" -v 1 \
--input-dirs ./model -O zz_generated.deepcopy \
--go-header-file "${SCRIPT_ROOT}/hack/boilerplate.txt" \
--output-base ./
--go-header-file "${SCRIPT_ROOT}/hack/boilerplate.txt"
"$@"
fi
4 changes: 2 additions & 2 deletions model/foreach_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ type ForEachState struct {
// +optional
BatchSize *intstr.IntOrString `json:"batchSize,omitempty"`
// Actions to be executed for each of the elements of inputCollection.
// +kubebuilder:validation:MinItems=1
Actions []Action `json:"actions,omitempty" validate:"required,min=1,dive"`
// +kubebuilder:validation:MinItems=0
Actions []Action `json:"actions,omitempty" validate:"required,min=0,dive"`
// State specific timeout.
// +optional
Timeouts *ForEachStateTimeout `json:"timeouts,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion model/foreach_state_validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ workflow.states[0].forEachState.mode is required`,
model.States[0].ForEachState.Actions = []Action{}
return *model
},
Err: `workflow.states[0].forEachState.actions must have the minimum 1`,
Err: ``,
},
}

Expand Down
4 changes: 2 additions & 2 deletions model/operation_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ type OperationState struct {
// +kubebuilder:default=sequential
ActionMode ActionMode `json:"actionMode,omitempty" validate:"required,oneofkind"`
// Actions to be performed
// +kubebuilder:validation:MinItems=1
Actions []Action `json:"actions" validate:"min=1,dive"`
// +kubebuilder:validation:MinItems=0
Actions []Action `json:"actions" validate:"min=0,dive"`
// State specific timeouts
// +optional
Timeouts *OperationStateTimeout `json:"timeouts,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion model/operation_state_validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func TestOperationStateStructLevelValidation(t *testing.T) {
model.States[0].OperationState.Actions = []Action{}
return *model
},
Err: `workflow.states[0].actions must have the minimum 1`,
Err: ``,
},
{
Desp: "oneofkind",
Expand Down