Skip to content

Commit

Permalink
Additional operator validation (#223)
Browse files Browse the repository at this point in the history
  • Loading branch information
bajb authored Oct 28, 2024
1 parent 01bc65b commit 9f52550
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion selector/predicates.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const (

type Predicate struct {
Key Key `json:"key" yaml:"key" validate:"predicate-key"`
Operator PredicateOperator `json:"operator" yaml:"operator" validate:"oneof=Equal NotEqual In NotIn Exists DoesNotExists Gt Lt Like InLike"`
Operator PredicateOperator `json:"operator" yaml:"operator" validate:"oneof=Equal NotEqual In NotIn Exists DoesNotExists Gt Lt Like InLike NotLike NotInLike"`
Conversion OperatorConversion `json:"conversion" yaml:"conversion" validate:"omitempty,oneof=TimeDow TimeMonth DurationSeconds DurationHours DurationDays"`
Values []string `json:"values" yaml:"values"`
}
2 changes: 1 addition & 1 deletion utils/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func TestValidation(t *testing.T) {
// _ = PrettyPrint(errs)
assert.Equal(t, 2, len(errs))
assert.Equal(t, errs["PayPalWebsitePaymentsProCredentials.SupportedCurrencies[0]"], "SupportedCurrencies[0] must be one of [AUD BRL CAD CZK DKK EUR HKD HUF INR ILS JPY MYR MXN TWD NZD NOK PHP PLN GBP RUB SGD SEK CHF THB USD]")
assert.Equal(t, errs["Definition.Selector.Expressions[0].Operator"], "Operator must be one of [Equal NotEqual In NotIn Exists DoesNotExists Gt Lt Like InLike]")
assert.Equal(t, errs["Definition.Selector.Expressions[0].Operator"], "Operator must be one of [Equal NotEqual In NotIn Exists DoesNotExists Gt Lt Like InLike NotLike NotInLike]")
}

func TestLowerCaseName(t *testing.T) {
Expand Down

0 comments on commit 9f52550

Please sign in to comment.