Skip to content

Commit 37b2f2f

Browse files
authored
feat: enable CEL optional types v2 and two-var comprehensions (#42)
1 parent 9b7da48 commit 37b2f2f

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

cmd/celfmt/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333
"github.com/google/cel-go/common"
3434
"github.com/google/cel-go/common/decls"
3535
"github.com/google/cel-go/common/types"
36+
"github.com/google/cel-go/ext"
3637
"github.com/mailgun/raymond/v2/ast"
3738
"github.com/mailgun/raymond/v2/parser"
3839
"gopkg.in/yaml.v3"
@@ -206,7 +207,8 @@ func celFmt(dst io.Writer, src, indent string) error {
206207
lib.Limit(nil),
207208
lib.Strings(),
208209
xmlHelper,
209-
cel.OptionalTypes(cel.OptionalTypesVersion(1)),
210+
cel.OptionalTypes(cel.OptionalTypesVersion(lib.OptionalTypesVersion)),
211+
ext.TwoVarComprehensions(ext.TwoVarComprehensionsVersion(lib.OptionalTypesVersion)),
210212
cel.EnableMacroCallTracking(),
211213
)
212214
if err != nil {

cmd/wasm/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ import (
4949
"github.com/google/cel-go/common"
5050
"github.com/google/cel-go/common/decls"
5151
"github.com/google/cel-go/common/types"
52+
"github.com/google/cel-go/ext"
5253

5354
"github.com/elastic/celfmt"
5455
)
@@ -74,7 +75,8 @@ func compileAndFormat(dst io.Writer, src string) error {
7475
lib.Limit(nil),
7576
lib.Strings(),
7677
xmlHelper,
77-
cel.OptionalTypes(cel.OptionalTypesVersion(1)),
78+
cel.OptionalTypes(cel.OptionalTypesVersion(lib.OptionalTypesVersion)),
79+
ext.TwoVarComprehensions(ext.TwoVarComprehensionsVersion(lib.OptionalTypesVersion)),
7880
cel.EnableMacroCallTracking(),
7981
)
8082
if err != nil {

0 commit comments

Comments
 (0)