Skip to content
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

add Like and InLike to validation #202

Merged
merged 2 commits into from
Jul 24, 2024
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
2 changes: 1 addition & 1 deletion selector/predicates.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,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"`
Operator PredicateOperator `json:"operator" yaml:"operator" validate:"oneof=Equal NotEqual In NotIn Exists DoesNotExists Gt Lt Like InLike"`
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]")
assert.Equal(t, errs["Definition.Selector.Expressions[0].Operator"], "Operator must be one of [Equal NotEqual In NotIn Exists DoesNotExists Gt Lt Like InLike]")
}

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