Skip to content

Commit

Permalink
Temporary disable CE SQL validation
Browse files Browse the repository at this point in the history
Signed-off-by: Ahmed Abdalla <[email protected]>
  • Loading branch information
devguyio committed Dec 22, 2021
1 parent aab5298 commit ca33e14
Show file tree
Hide file tree
Showing 92 changed files with 1 addition and 19,183 deletions.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cloudevents/conformance v0.2.0
github.com/cloudevents/sdk-go/observability/opencensus/v2 v2.4.1
github.com/cloudevents/sdk-go/sql/v2 v2.7.0
github.com/cloudevents/sdk-go/v2 v2.7.0
github.com/dgryski/go-gk v0.0.0-20200319235926-a69029f61654 // indirect
github.com/golang/protobuf v1.5.2
Expand Down
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ github.com/alecthomas/jsonschema v0.0.0-20180308105923-f2c93856175a/go.mod h1:qp
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/antlr/antlr4 v0.0.0-20210105192202-5c2b686f95e1 h1:9K5yytxEEQc4yIn6c1rvQD6qQilQn9mYIF7pXKPT8i4=
github.com/antlr/antlr4 v0.0.0-20210105192202-5c2b686f95e1/go.mod h1:T7PbCXFs94rrTttyxjbyT5+/1V8T2TYDejxUfHJjw1Y=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
Expand Down Expand Up @@ -121,8 +119,6 @@ github.com/cloudevents/conformance v0.2.0 h1:NvSXOKlagcsOWMEbi8U7Ex/0oQ4JZE1HQ45
github.com/cloudevents/conformance v0.2.0/go.mod h1:rHKDwylBH89Rns6U3wL9ww8bg9/4GbwRCDNuyoC6bcc=
github.com/cloudevents/sdk-go/observability/opencensus/v2 v2.4.1 h1:UHjY9+DJyjELyFA8vU/KHHXix1F1z7QLFskzdJZkP+0=
github.com/cloudevents/sdk-go/observability/opencensus/v2 v2.4.1/go.mod h1:lhEpxMrIUkeu9rVRgoAbyqZ8GR8Hd3DUy+thHUxAHoI=
github.com/cloudevents/sdk-go/sql/v2 v2.7.0 h1:+z92bVkW/B9yCUbpNNiHstb5oyqOaGQH08sYcm0QRo8=
github.com/cloudevents/sdk-go/sql/v2 v2.7.0/go.mod h1:zstvxyTe102YSI3TJ1Dm3NIglgZJmFqL5Dv8XxroBGw=
github.com/cloudevents/sdk-go/v2 v2.4.1/go.mod h1:MZiMwmAh5tGj+fPFvtHv9hKurKqXtdB9haJYMJ/7GJY=
github.com/cloudevents/sdk-go/v2 v2.7.0 h1:Pt+cOKWNG0tZZKRzuvfVsxcWArO0eq/UPKUxskyuSb8=
github.com/cloudevents/sdk-go/v2 v2.7.0/go.mod h1:GpCBmUj7DIRiDhVvsK5d6WCbgTWs8DxAWTRtAwQmIXs=
Expand Down
14 changes: 0 additions & 14 deletions pkg/apis/eventing/v1/trigger_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"fmt"
"regexp"

cesqlparser "github.com/cloudevents/sdk-go/sql/v2/parser"
corev1 "k8s.io/api/core/v1"
"knative.dev/pkg/apis"
"knative.dev/pkg/kmp"
Expand Down Expand Up @@ -194,17 +193,6 @@ func ValidateSubscriptionAPIFiltersList(ctx context.Context, filters []Subscript
return errs
}

func ValidateCESQLExpression(ctx context.Context, expression string) (errs *apis.FieldError) {
if expression == "" {
return nil
}
_, err := cesqlparser.Parse(expression)
if err != nil {
return apis.ErrInvalidValue(expression, apis.CurrentField, err.Error())
}
return nil
}

func ValidateSubscriptionAPIFilter(ctx context.Context, filter *SubscriptionsAPIFilter) (errs *apis.FieldError) {
if filter == nil {
return nil
Expand All @@ -223,8 +211,6 @@ func ValidateSubscriptionAPIFilter(ctx context.Context, filter *SubscriptionsAPI
ValidateSubscriptionAPIFiltersList(ctx, filter.Any).ViaField("any"),
).Also(
ValidateSubscriptionAPIFilter(ctx, filter.Not).ViaField("not"),
).Also(
ValidateCESQLExpression(ctx, filter.SQL).ViaField("sql"),
)
return errs
}
Expand Down
8 changes: 1 addition & 7 deletions pkg/apis/eventing/v1/trigger_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -712,13 +712,7 @@ func TestFilterSpecValidation(t *testing.T) {
want: apis.ErrInvalidKeyName("invALID", apis.CurrentField,
"Attribute name must start with a letter and can only contain "+
"lowercase alphanumeric").ViaFieldKey("prefix", "invALID").ViaFieldIndex("any", 2).ViaFieldIndex("filters", 0)}, {
name: "CE SQL with syntax error",
filters: []SubscriptionsAPIFilter{
{
SQL: "this is wrong",
}},
want: apis.ErrInvalidValue("this is wrong", "sql", "syntax error: ").ViaFieldIndex("filters", 0),
}, {
//TODO: Add CE validation once this is merged https://github.com/cloudevents/sdk-go/pull/748
name: "Valid CE SQL expression",
filters: []SubscriptionsAPIFilter{
{
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit ca33e14

Please sign in to comment.