Skip to content

Commit

Permalink
Merge pull request #3 from authzed/update-rename
Browse files Browse the repository at this point in the history
Rename for recent update
  • Loading branch information
josephschorr committed May 2, 2024
2 parents bf934ab + 7f10e5f commit b707d13
Show file tree
Hide file tree
Showing 216 changed files with 713 additions and 687 deletions.
90 changes: 45 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Common Expression Language

[![Go Report Card](https://goreportcard.com/badge/github.com/google/cel-go)](https://goreportcard.com/report/github.com/google/cel-go)
[![GoDoc](https://godoc.org/github.com/google/cel-go?status.svg)][6]
[![Go Report Card](https://goreportcard.com/badge/github.com/authzed/cel-go)](https://goreportcard.com/report/github.com/authzed/cel-go)
[![GoDoc](https://godoc.org/github.com/authzed/cel-go?status.svg)][6]

The Common Expression Language (CEL) is a non-Turing complete language designed
for simplicity, speed, safety, and portability. CEL's C-like [syntax][1] looks
Expand All @@ -19,7 +19,7 @@ request.time - resource.age < duration("24h")

```typescript
// Check whether all resource names in a list match a given filter.
auth.claims.email_verified && resources.all(r, r.startsWith(auth.claims.email))
auth.claims.email_verified && resources.all(r, r.startsWith(auth.claims.email));
```

A CEL "program" is a single expression. The examples have been tagged as
Expand All @@ -35,16 +35,16 @@ A dashboard that shows results of cel-go conformance tests can be found

---

* [Overview](#overview)
* [Environment Setup](#environment-setup)
* [Parse and Check](#parse-and-check)
* [Macros](#macros)
* [Evaluate](#evaluate)
* [Errors](#Errors)
* [Examples](examples/README.md)
* [Install](#install)
* [Common Questions](#common-questions)
* [License](#license)
- [Overview](#overview)
- [Environment Setup](#environment-setup)
- [Parse and Check](#parse-and-check)
- [Macros](#macros)
- [Evaluate](#evaluate)
- [Errors](#Errors)
- [Examples](examples/README.md)
- [Install](#install)
- [Common Questions](#common-questions)
- [License](#license)

---

Expand All @@ -56,11 +56,11 @@ against some input. Checking is optional, but strongly encouraged.

### Environment Setup

Let's expose `name` and `group` variables to CEL using the `cel.Declarations`
Let's expose `name` and `group` variables to CEL using the `cel.Declarations`
environment option:

```go
import "github.com/google/cel-go/cel"
import "github.com/authzed/cel-go/cel"

env, err := cel.NewEnv(
cel.Variable("name", cel.StringType),
Expand Down Expand Up @@ -116,7 +116,7 @@ list and map values.

```javascript
// Ensure all tweets are less than 140 chars
tweets.all(t, t.size() <= 140)
tweets.all(t, t.size() <= 140);
```

The `has` macro is useful for unifying field presence testing logic across
Expand All @@ -125,7 +125,7 @@ protobuf types and dynamic (JSON-like) types.
```javascript
// Test whether the field is a non-default value if proto-based, or defined
// in the JSON case.
has(message.field)
has(message.field);
```

Both cases traditionally require special syntax at the language level, but
Expand Down Expand Up @@ -170,22 +170,22 @@ unknown values, with the `?` indicating that the branch is not taken due to
short-circuiting. When the result is `<x, y>` this means that the both args
are possibly relevant to the result.

| Expression | Result |
|---------------------|----------|
| `false && ?` | `false` |
| `true && false` | `false` |
| `<x> && false` | `false` |
| `true && true` | `true` |
| `true && <x>` | `<x>` |
| `<x> && true` | `<x>` |
| `<x> && <y>` | `<x, y>` |
| `true \|\| ?` | `true` |
| `false \|\| true` | `true` |
| `<x> \|\| true` | `true` |
| `false \|\| false` | `false` |
| `false \|\| <x>` | `<x>` |
| `<x> \|\| false` | `<x>` |
| `<x> \|\| <y>` | `<x, y>` |
| Expression | Result |
| ------------------ | -------- |
| `false && ?` | `false` |
| `true && false` | `false` |
| `<x> && false` | `false` |
| `true && true` | `true` |
| `true && <x>` | `<x>` |
| `<x> && true` | `<x>` |
| `<x> && <y>` | `<x, y>` |
| `true \|\| ?` | `true` |
| `false \|\| true` | `true` |
| `<x> \|\| true` | `true` |
| `false \|\| false` | `false` |
| `false \|\| <x>` | `<x>` |
| `<x> \|\| false` | `<x>` |
| `<x> \|\| <y>` | `<x, y>` |

In the cases where unknowns are expected, `cel.EvalOptions(cel.OptTrackState)`
should be enabled. The `details` value returned by `Eval()` will contain the
Expand Down Expand Up @@ -253,19 +253,19 @@ runtime bindings and error handling to do the right thing.

### Where can I learn more about the language?

* See the [CEL Spec][1] for the specification and conformance test suite.
* Ask for support on the [CEL Go Discuss][2] Google group.
- See the [CEL Spec][1] for the specification and conformance test suite.
- Ask for support on the [CEL Go Discuss][2] Google group.

### Where can I learn more about the internals?

* See [GoDoc][6] to learn how to integrate CEL into services written in Go.
* See the [CEL C++][3] toolchain (under development) for information about how
- See [GoDoc][6] to learn how to integrate CEL into services written in Go.
- See the [CEL C++][3] toolchain (under development) for information about how
to integrate CEL evaluation into other environments.

### How can I contribute?

* See [CONTRIBUTING.md](./CONTRIBUTING.md) to get started.
* Use [GitHub Issues][4] to request features or report bugs.
- See [CONTRIBUTING.md](./CONTRIBUTING.md) to get started.
- Use [GitHub Issues][4] to request features or report bugs.

### Some tests don't work with `go test`?

Expand All @@ -283,9 +283,9 @@ Released under the [Apache License](LICENSE).

Disclaimer: This is not an official Google product.

[1]: https://github.com/google/cel-spec
[2]: https://groups.google.com/forum/#!forum/cel-go-discuss
[3]: https://github.com/google/cel-cpp
[4]: https://github.com/google/cel-go/issues
[5]: https://bazel.build
[6]: https://godoc.org/github.com/google/cel-go
[1]: https://github.com/google/cel-spec
[2]: https://groups.google.com/forum/#!forum/cel-go-discuss
[3]: https://github.com/google/cel-cpp
[4]: https://github.com/authzed/cel-go/issues
[5]: https://bazel.build
[6]: https://godoc.org/github.com/authzed/cel-go
2 changes: 1 addition & 1 deletion cel/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ go_library(
"program.go",
"validator.go",
],
importpath = "github.com/google/cel-go/cel",
importpath = "github.com/authzed/cel-go/cel",
visibility = ["//visibility:public"],
deps = [
"//checker:go_default_library",
Expand Down
6 changes: 3 additions & 3 deletions cel/cel_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import (
"fmt"
"log"

"github.com/google/cel-go/cel"
"github.com/google/cel-go/common/types"
"github.com/google/cel-go/common/types/ref"
"github.com/authzed/cel-go/cel"
"github.com/authzed/cel-go/common/types"
"github.com/authzed/cel-go/common/types/ref"
)

func Example() {
Expand Down
24 changes: 12 additions & 12 deletions cel/cel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ import (
"google.golang.org/protobuf/reflect/protodesc"
"google.golang.org/protobuf/reflect/protoreflect"

"github.com/google/cel-go/checker"
celast "github.com/google/cel-go/common/ast"
"github.com/google/cel-go/common/operators"
"github.com/google/cel-go/common/overloads"
"github.com/google/cel-go/common/types"
"github.com/google/cel-go/common/types/ref"
"github.com/google/cel-go/common/types/traits"
"github.com/google/cel-go/interpreter"
"github.com/google/cel-go/parser"
"github.com/google/cel-go/test"
"github.com/authzed/cel-go/checker"
celast "github.com/authzed/cel-go/common/ast"
"github.com/authzed/cel-go/common/operators"
"github.com/authzed/cel-go/common/overloads"
"github.com/authzed/cel-go/common/types"
"github.com/authzed/cel-go/common/types/ref"
"github.com/authzed/cel-go/common/types/traits"
"github.com/authzed/cel-go/interpreter"
"github.com/authzed/cel-go/parser"
"github.com/authzed/cel-go/test"

exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1"
descpb "google.golang.org/protobuf/types/descriptorpb"
Expand All @@ -47,8 +47,8 @@ import (
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
wrapperspb "google.golang.org/protobuf/types/known/wrapperspb"

proto2pb "github.com/google/cel-go/test/proto2pb"
proto3pb "github.com/google/cel-go/test/proto3pb"
proto2pb "github.com/authzed/cel-go/test/proto2pb"
proto3pb "github.com/authzed/cel-go/test/proto3pb"
)

func Test_ExampleWithBuiltins(t *testing.T) {
Expand Down
10 changes: 5 additions & 5 deletions cel/decls.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ package cel
import (
"fmt"

"github.com/google/cel-go/common/ast"
"github.com/google/cel-go/common/decls"
"github.com/google/cel-go/common/functions"
"github.com/google/cel-go/common/types"
"github.com/google/cel-go/common/types/ref"
"github.com/authzed/cel-go/common/ast"
"github.com/authzed/cel-go/common/decls"
"github.com/authzed/cel-go/common/functions"
"github.com/authzed/cel-go/common/types"
"github.com/authzed/cel-go/common/types/ref"

exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1"
)
Expand Down
16 changes: 8 additions & 8 deletions cel/decls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ import (
"strings"
"testing"

chkdecls "github.com/google/cel-go/checker/decls"
"github.com/google/cel-go/common/decls"
"github.com/google/cel-go/common/functions"
"github.com/google/cel-go/common/operators"
"github.com/google/cel-go/common/overloads"
"github.com/google/cel-go/common/types"
"github.com/google/cel-go/common/types/ref"
"github.com/google/cel-go/common/types/traits"
chkdecls "github.com/authzed/cel-go/checker/decls"
"github.com/authzed/cel-go/common/decls"
"github.com/authzed/cel-go/common/functions"
"github.com/authzed/cel-go/common/operators"
"github.com/authzed/cel-go/common/overloads"
"github.com/authzed/cel-go/common/types"
"github.com/authzed/cel-go/common/types/ref"
"github.com/authzed/cel-go/common/types/traits"

exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1"
)
Expand Down
20 changes: 10 additions & 10 deletions cel/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ import (
"errors"
"sync"

"github.com/google/cel-go/checker"
chkdecls "github.com/google/cel-go/checker/decls"
"github.com/google/cel-go/common"
celast "github.com/google/cel-go/common/ast"
"github.com/google/cel-go/common/containers"
"github.com/google/cel-go/common/decls"
"github.com/google/cel-go/common/types"
"github.com/google/cel-go/common/types/ref"
"github.com/google/cel-go/interpreter"
"github.com/google/cel-go/parser"
"github.com/authzed/cel-go/checker"
chkdecls "github.com/authzed/cel-go/checker/decls"
"github.com/authzed/cel-go/common"
celast "github.com/authzed/cel-go/common/ast"
"github.com/authzed/cel-go/common/containers"
"github.com/authzed/cel-go/common/decls"
"github.com/authzed/cel-go/common/types"
"github.com/authzed/cel-go/common/types/ref"
"github.com/authzed/cel-go/interpreter"
"github.com/authzed/cel-go/parser"

exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1"
)
Expand Down
10 changes: 5 additions & 5 deletions cel/env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ import (
"sync"
"testing"

"github.com/google/cel-go/common"
"github.com/google/cel-go/common/operators"
"github.com/google/cel-go/common/types"
"github.com/google/cel-go/common/types/ref"
"github.com/authzed/cel-go/common"
"github.com/authzed/cel-go/common/operators"
"github.com/authzed/cel-go/common/types"
"github.com/authzed/cel-go/common/types/ref"

proto3pb "github.com/google/cel-go/test/proto3pb"
proto3pb "github.com/authzed/cel-go/test/proto3pb"
exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1"
)

Expand Down
12 changes: 6 additions & 6 deletions cel/folding.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ package cel
import (
"fmt"

"github.com/google/cel-go/common/ast"
"github.com/google/cel-go/common/operators"
"github.com/google/cel-go/common/overloads"
"github.com/google/cel-go/common/types"
"github.com/google/cel-go/common/types/ref"
"github.com/google/cel-go/common/types/traits"
"github.com/authzed/cel-go/common/ast"
"github.com/authzed/cel-go/common/operators"
"github.com/authzed/cel-go/common/overloads"
"github.com/authzed/cel-go/common/types"
"github.com/authzed/cel-go/common/types/ref"
"github.com/authzed/cel-go/common/types/traits"
)

// ConstantFoldingOption defines a functional option for configuring constant folding.
Expand Down
4 changes: 2 additions & 2 deletions cel/folding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import (
"google.golang.org/protobuf/encoding/prototext"
"google.golang.org/protobuf/proto"

"github.com/google/cel-go/common/ast"
"github.com/authzed/cel-go/common/ast"

proto3pb "github.com/google/cel-go/test/proto3pb"
proto3pb "github.com/authzed/cel-go/test/proto3pb"
exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1"
)

Expand Down
12 changes: 6 additions & 6 deletions cel/inlining.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
package cel

import (
"github.com/google/cel-go/common/ast"
"github.com/google/cel-go/common/containers"
"github.com/google/cel-go/common/operators"
"github.com/google/cel-go/common/overloads"
"github.com/google/cel-go/common/types"
"github.com/google/cel-go/common/types/traits"
"github.com/authzed/cel-go/common/ast"
"github.com/authzed/cel-go/common/containers"
"github.com/authzed/cel-go/common/operators"
"github.com/authzed/cel-go/common/overloads"
"github.com/authzed/cel-go/common/types"
"github.com/authzed/cel-go/common/types/traits"
)

// InlineVariable holds a variable name to be matched and an AST representing
Expand Down
4 changes: 2 additions & 2 deletions cel/inlining_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ package cel_test
import (
"testing"

"github.com/google/cel-go/cel"
"github.com/authzed/cel-go/cel"

proto3pb "github.com/google/cel-go/test/proto3pb"
proto3pb "github.com/authzed/cel-go/test/proto3pb"
)

func TestInliningOptimizer(t *testing.T) {
Expand Down
12 changes: 6 additions & 6 deletions cel/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ import (

"google.golang.org/protobuf/proto"

"github.com/google/cel-go/common"
"github.com/google/cel-go/common/ast"
"github.com/google/cel-go/common/types"
"github.com/google/cel-go/common/types/ref"
"github.com/google/cel-go/common/types/traits"
"github.com/google/cel-go/parser"
"github.com/authzed/cel-go/common"
"github.com/authzed/cel-go/common/ast"
"github.com/authzed/cel-go/common/types"
"github.com/authzed/cel-go/common/types/ref"
"github.com/authzed/cel-go/common/types/traits"
"github.com/authzed/cel-go/parser"

exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1"
anypb "google.golang.org/protobuf/types/known/anypb"
Expand Down
6 changes: 3 additions & 3 deletions cel/io_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import (

"google.golang.org/protobuf/proto"

"github.com/google/cel-go/checker/decls"
"github.com/google/cel-go/common/types"
"github.com/authzed/cel-go/checker/decls"
"github.com/authzed/cel-go/common/types"

proto3pb "github.com/google/cel-go/test/proto3pb"
proto3pb "github.com/authzed/cel-go/test/proto3pb"
exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1"
)

Expand Down
Loading

0 comments on commit b707d13

Please sign in to comment.