From 487f6881a8660b1b4fa5dd6d92cb21c3c4a56b23 Mon Sep 17 00:00:00 2001
From: Ahmed Abdalla
Date: Tue, 15 Feb 2022 13:09:27 +0100
Subject: [PATCH 1/6] Rename new trigger filters SQL field to CESQL
Signed-off-by: Ahmed Abdalla
---
docs/eventing-api.md | 4 +-
pkg/apis/eventing/v1/trigger_types.go | 4 +-
pkg/apis/eventing/v1/trigger_validation.go | 4 +-
.../eventing/v1/trigger_validation_test.go | 4 +-
pkg/broker/filter/filter_handler.go | 6 +--
pkg/broker/filter/filter_handler_test.go | 4 +-
.../features/new_trigger_filters/filters.go | 2 +-
.../antlr/antlr4/runtime/Go/antlr/LICENSE.txt | 52 +++++++++++++++++++
vendor/github.com/antlr/antlr4/LICENSE.txt | 52 +++++++++++++++++++
9 files changed, 118 insertions(+), 14 deletions(-)
create mode 100644 third_party/VENDOR-LICENSE/github.com/antlr/antlr4/runtime/Go/antlr/LICENSE.txt
create mode 100644 vendor/github.com/antlr/antlr4/LICENSE.txt
diff --git a/docs/eventing-api.md b/docs/eventing-api.md
index 5a4e5396b28..5dfcf37598a 100644
--- a/docs/eventing-api.md
+++ b/docs/eventing-api.md
@@ -2091,14 +2091,14 @@ expression cannot be empty strings.
-sql
+cesql
string
|
(Optional)
- SQL is a CloudEvents SQL expression that will be evaluated to true or false against each CloudEvent.
+CESQL is a CloudEvents CESQL expression that will be evaluated to true or false against each CloudEvent.
|
diff --git a/pkg/apis/eventing/v1/trigger_types.go b/pkg/apis/eventing/v1/trigger_types.go
index 2e15d5454aa..dadaecbbdfe 100644
--- a/pkg/apis/eventing/v1/trigger_types.go
+++ b/pkg/apis/eventing/v1/trigger_types.go
@@ -169,10 +169,10 @@ type SubscriptionsAPIFilter struct {
// +optional
Suffix map[string]string `json:"suffix,omitempty"`
- // SQL is a CloudEvents SQL expression that will be evaluated to true or false against each CloudEvent.
+ // CESQL is a CloudEvents CESQL expression that will be evaluated to true or false against each CloudEvent.
//
// +optional
- SQL string `json:"sql,omitempty"`
+ CESQL string `json:"cesql,omitempty"`
}
// TriggerFilterAttributes is a map of context attribute names to values for
diff --git a/pkg/apis/eventing/v1/trigger_validation.go b/pkg/apis/eventing/v1/trigger_validation.go
index ac033c1d8ba..63660c779e9 100644
--- a/pkg/apis/eventing/v1/trigger_validation.go
+++ b/pkg/apis/eventing/v1/trigger_validation.go
@@ -223,7 +223,7 @@ func ValidateSubscriptionAPIFilter(ctx context.Context, filter *SubscriptionsAPI
).Also(
ValidateSubscriptionAPIFilter(ctx, filter.Not).ViaField("not"),
).Also(
- ValidateCESQLExpression(ctx, filter.SQL).ViaField("sql"),
+ ValidateCESQLExpression(ctx, filter.CESQL).ViaField("sql"),
)
return errs
}
@@ -275,7 +275,7 @@ func hasMultipleDialects(filter *SubscriptionsAPIFilter) bool {
dialectFound = true
}
}
- if filter.SQL != "" && dialectFound {
+ if filter.CESQL != "" && dialectFound {
return true
}
return false
diff --git a/pkg/apis/eventing/v1/trigger_validation_test.go b/pkg/apis/eventing/v1/trigger_validation_test.go
index 33e53e01e07..3819526ec71 100644
--- a/pkg/apis/eventing/v1/trigger_validation_test.go
+++ b/pkg/apis/eventing/v1/trigger_validation_test.go
@@ -715,14 +715,14 @@ func TestFilterSpecValidation(t *testing.T) {
name: "CE SQL with syntax error",
filters: []SubscriptionsAPIFilter{
{
- SQL: "this is wrong",
+ CESQL: "this is wrong",
}},
want: apis.ErrInvalidValue("this is wrong", "sql", "syntax error: ").ViaFieldIndex("filters", 0),
}, {
name: "Valid CE SQL expression",
filters: []SubscriptionsAPIFilter{
{
- SQL: "type = 'dev.knative' AND ttl < 3",
+ CESQL: "type = 'dev.knative' AND ttl < 3",
}},
},
}
diff --git a/pkg/broker/filter/filter_handler.go b/pkg/broker/filter/filter_handler.go
index b90e8546388..62a37ed754b 100644
--- a/pkg/broker/filter/filter_handler.go
+++ b/pkg/broker/filter/filter_handler.go
@@ -392,10 +392,10 @@ func materializeSubscriptionsAPIFilter(ctx context.Context, filter eventingv1.Su
materializedFilter = subscriptionsapi.NewAnyFilter(materializeFiltersList(ctx, filter.Any)...)
case filter.Not != nil:
materializedFilter = subscriptionsapi.NewNotFilter(materializeSubscriptionsAPIFilter(ctx, *filter.Not))
- case filter.SQL != "":
- if materializedFilter, err = subscriptionsapi.NewCESQLFilter(filter.SQL); err != nil {
+ case filter.CESQL != "":
+ if materializedFilter, err = subscriptionsapi.NewCESQLFilter(filter.CESQL); err != nil {
// This is weird, CESQL expression should be validated when Trigger's are created.
- logging.FromContext(ctx).Debugw("Found an Invalid CE SQL expression", zap.String("expression", filter.SQL))
+ logging.FromContext(ctx).Debugw("Found an Invalid CE SQL expression", zap.String("expression", filter.CESQL))
return nil
}
}
diff --git a/pkg/broker/filter/filter_handler_test.go b/pkg/broker/filter/filter_handler_test.go
index 2a63514ecf5..f05bd82c197 100644
--- a/pkg/broker/filter/filter_handler_test.go
+++ b/pkg/broker/filter/filter_handler_test.go
@@ -563,7 +563,7 @@ func TestReceiver_WithSubscriptionsAPI(t *testing.T) {
"Dispatch succeeded - Source with type": {
triggers: []*eventingv1.Trigger{
makeTrigger(withSubscriptionAPIFilter(&eventingv1.SubscriptionsAPIFilter{
- SQL: fmt.Sprintf("type = '%s' AND source = '%s'", eventType, eventSource),
+ CESQL: fmt.Sprintf("type = '%s' AND source = '%s'", eventType, eventSource),
})),
},
expectedDispatch: true,
@@ -574,7 +574,7 @@ func TestReceiver_WithSubscriptionsAPI(t *testing.T) {
triggers: []*eventingv1.Trigger{
makeTrigger(
withSubscriptionAPIFilter(&eventingv1.SubscriptionsAPIFilter{
- SQL: fmt.Sprintf("type = '%s' AND source = '%s'", eventType, eventSource),
+ CESQL: fmt.Sprintf("type = '%s' AND source = '%s'", eventType, eventSource),
}),
withAttributesFilter(&eventingv1.TriggerFilter{
Attributes: map[string]string{"type": "some-other-type", "source": "some-other-source"},
diff --git a/test/experimental/features/new_trigger_filters/filters.go b/test/experimental/features/new_trigger_filters/filters.go
index d60123327fc..838cc4d729d 100644
--- a/test/experimental/features/new_trigger_filters/filters.go
+++ b/test/experimental/features/new_trigger_filters/filters.go
@@ -56,7 +56,7 @@ func FiltersFeatureSet(brokerName string) *feature.FeatureSet {
filters: fmt.Sprintf(snippetFor("suffix"), matchedEvent.Type()[5:], matchedEvent.Source()[5:]),
},
"CloudEvents SQL filter": {
- filters: fmt.Sprintf(`- sql: "type = '%s' AND source = '%s'" `, matchedEvent.Type(), matchedEvent.Source()),
+ filters: fmt.Sprintf(`- cesql: "type = '%s' AND source = '%s'" `, matchedEvent.Type(), matchedEvent.Source()),
},
}
diff --git a/third_party/VENDOR-LICENSE/github.com/antlr/antlr4/runtime/Go/antlr/LICENSE.txt b/third_party/VENDOR-LICENSE/github.com/antlr/antlr4/runtime/Go/antlr/LICENSE.txt
new file mode 100644
index 00000000000..2042d1bda6c
--- /dev/null
+++ b/third_party/VENDOR-LICENSE/github.com/antlr/antlr4/runtime/Go/antlr/LICENSE.txt
@@ -0,0 +1,52 @@
+[The "BSD 3-clause license"]
+Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the copyright holder nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=====
+
+MIT License for codepointat.js from https://git.io/codepointat
+MIT License for fromcodepoint.js from https://git.io/vDW1m
+
+Copyright Mathias Bynens
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/vendor/github.com/antlr/antlr4/LICENSE.txt b/vendor/github.com/antlr/antlr4/LICENSE.txt
new file mode 100644
index 00000000000..2042d1bda6c
--- /dev/null
+++ b/vendor/github.com/antlr/antlr4/LICENSE.txt
@@ -0,0 +1,52 @@
+[The "BSD 3-clause license"]
+Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the copyright holder nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=====
+
+MIT License for codepointat.js from https://git.io/codepointat
+MIT License for fromcodepoint.js from https://git.io/vDW1m
+
+Copyright Mathias Bynens
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
From ffb29afa048ce70df5bc48b673caf1cdef45062e Mon Sep 17 00:00:00 2001
From: Ahmed Abdalla
Date: Tue, 15 Feb 2022 13:32:25 +0100
Subject: [PATCH 2/6] run hack/update-codegen.sh
Signed-off-by: Ahmed Abdalla
---
.../antlr/antlr4/runtime/Go/antlr/LICENSE.txt | 52 -------------------
vendor/github.com/antlr/antlr4/LICENSE.txt | 52 -------------------
2 files changed, 104 deletions(-)
delete mode 100644 third_party/VENDOR-LICENSE/github.com/antlr/antlr4/runtime/Go/antlr/LICENSE.txt
delete mode 100644 vendor/github.com/antlr/antlr4/LICENSE.txt
diff --git a/third_party/VENDOR-LICENSE/github.com/antlr/antlr4/runtime/Go/antlr/LICENSE.txt b/third_party/VENDOR-LICENSE/github.com/antlr/antlr4/runtime/Go/antlr/LICENSE.txt
deleted file mode 100644
index 2042d1bda6c..00000000000
--- a/third_party/VENDOR-LICENSE/github.com/antlr/antlr4/runtime/Go/antlr/LICENSE.txt
+++ /dev/null
@@ -1,52 +0,0 @@
-[The "BSD 3-clause license"]
-Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. Neither the name of the copyright holder nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-=====
-
-MIT License for codepointat.js from https://git.io/codepointat
-MIT License for fromcodepoint.js from https://git.io/vDW1m
-
-Copyright Mathias Bynens
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/vendor/github.com/antlr/antlr4/LICENSE.txt b/vendor/github.com/antlr/antlr4/LICENSE.txt
deleted file mode 100644
index 2042d1bda6c..00000000000
--- a/vendor/github.com/antlr/antlr4/LICENSE.txt
+++ /dev/null
@@ -1,52 +0,0 @@
-[The "BSD 3-clause license"]
-Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. Neither the name of the copyright holder nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-=====
-
-MIT License for codepointat.js from https://git.io/codepointat
-MIT License for fromcodepoint.js from https://git.io/vDW1m
-
-Copyright Mathias Bynens
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
From d8692ee7a50dec21d1063fe3185fff1ba16bf017 Mon Sep 17 00:00:00 2001
From: Ahmed Abdalla
Date: Tue, 15 Feb 2022 17:51:28 +0100
Subject: [PATCH 3/6] fix typo in docs
Signed-off-by: Ahmed Abdalla
---
docs/eventing-api.md | 2 +-
pkg/apis/eventing/v1/trigger_types.go | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/eventing-api.md b/docs/eventing-api.md
index 5dfcf37598a..89aeb3a2f0e 100644
--- a/docs/eventing-api.md
+++ b/docs/eventing-api.md
@@ -2098,7 +2098,7 @@ string
(Optional)
- CESQL is a CloudEvents CESQL expression that will be evaluated to true or false against each CloudEvent.
+CESQL is a CloudEvents SQL expression that will be evaluated to true or false against each CloudEvent.
|
diff --git a/pkg/apis/eventing/v1/trigger_types.go b/pkg/apis/eventing/v1/trigger_types.go
index dadaecbbdfe..e327fff0e0a 100644
--- a/pkg/apis/eventing/v1/trigger_types.go
+++ b/pkg/apis/eventing/v1/trigger_types.go
@@ -169,7 +169,7 @@ type SubscriptionsAPIFilter struct {
// +optional
Suffix map[string]string `json:"suffix,omitempty"`
- // CESQL is a CloudEvents CESQL expression that will be evaluated to true or false against each CloudEvent.
+ // CESQL is a CloudEvents SQL expression that will be evaluated to true or false against each CloudEvent.
//
// +optional
CESQL string `json:"cesql,omitempty"`
From 9119e202e4e43a2ac8a26895fcbdfff156a237b8 Mon Sep 17 00:00:00 2001
From: Ahmed Abdalla
Date: Wed, 16 Feb 2022 08:48:14 +0100
Subject: [PATCH 4/6] fix validation cesql viaField
Signed-off-by: Ahmed Abdalla
---
pkg/apis/eventing/v1/trigger_validation.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pkg/apis/eventing/v1/trigger_validation.go b/pkg/apis/eventing/v1/trigger_validation.go
index 63660c779e9..bab5aa41f62 100644
--- a/pkg/apis/eventing/v1/trigger_validation.go
+++ b/pkg/apis/eventing/v1/trigger_validation.go
@@ -223,7 +223,7 @@ func ValidateSubscriptionAPIFilter(ctx context.Context, filter *SubscriptionsAPI
).Also(
ValidateSubscriptionAPIFilter(ctx, filter.Not).ViaField("not"),
).Also(
- ValidateCESQLExpression(ctx, filter.CESQL).ViaField("sql"),
+ ValidateCESQLExpression(ctx, filter.CESQL).ViaField("cesql"),
)
return errs
}
From 208e9fefddd8c7a9ca7f9621a8f52daddb2afa69 Mon Sep 17 00:00:00 2001
From: Ahmed Abdalla
Date: Wed, 16 Feb 2022 08:49:24 +0100
Subject: [PATCH 5/6] fix comment
Signed-off-by: Ahmed Abdalla
---
test/experimental/features/new_trigger_filters/filters.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/experimental/features/new_trigger_filters/filters.go b/test/experimental/features/new_trigger_filters/filters.go
index 838cc4d729d..6e6176415f0 100644
--- a/test/experimental/features/new_trigger_filters/filters.go
+++ b/test/experimental/features/new_trigger_filters/filters.go
@@ -34,7 +34,7 @@ import (
// FiltersFeatureSet creates a feature set for testing the broker implementation of the new trigger filters experimental feature
// (aka Cloud Events Subscriptions API filters). It requires a created and ready Broker resource with brokerName.
//
-// The feature set tests four filter dialects: exact, prefix, suffix and sql (aka CloudEvents SQL).
+// The feature set tests four filter dialects: exact, prefix, suffix and cesql (aka CloudEvents SQL).
func FiltersFeatureSet(brokerName string) *feature.FeatureSet {
matchedEvent := FullEvent()
unmatchedEvent := MinEvent()
From f022becbc7cbdf51e09359104141dac49500ac95 Mon Sep 17 00:00:00 2001
From: Ahmed Abdalla
Date: Wed, 16 Feb 2022 09:48:32 +0100
Subject: [PATCH 6/6] fix trigger validation tests
Signed-off-by: Ahmed Abdalla
---
pkg/apis/eventing/v1/trigger_validation_test.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pkg/apis/eventing/v1/trigger_validation_test.go b/pkg/apis/eventing/v1/trigger_validation_test.go
index 3819526ec71..2294e8f6ccf 100644
--- a/pkg/apis/eventing/v1/trigger_validation_test.go
+++ b/pkg/apis/eventing/v1/trigger_validation_test.go
@@ -717,7 +717,7 @@ func TestFilterSpecValidation(t *testing.T) {
{
CESQL: "this is wrong",
}},
- want: apis.ErrInvalidValue("this is wrong", "sql", "syntax error: ").ViaFieldIndex("filters", 0),
+ want: apis.ErrInvalidValue("this is wrong", "cesql", "syntax error: ").ViaFieldIndex("filters", 0),
}, {
name: "Valid CE SQL expression",
filters: []SubscriptionsAPIFilter{