Skip to content

Commit

Permalink
move back
Browse files Browse the repository at this point in the history
  • Loading branch information
oliversun9 committed Dec 20, 2023
1 parent c37d354 commit 852ae23
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
3 changes: 1 addition & 2 deletions internal/constraints/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package constraints
import (
"buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate"
"buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate/priv"
"github.com/bufbuild/protovalidate-go/celext"
"github.com/bufbuild/protovalidate-go/internal/errors"
"github.com/bufbuild/protovalidate-go/internal/expression"
"github.com/google/cel-go/cel"
Expand Down Expand Up @@ -115,7 +114,7 @@ func (c *Cache) prepareEnvironment(
) (*cel.Env, error) {
env, err := env.Extend(
cel.Types(rules.Interface()),
cel.Variable("this", celext.ProtoFieldToCELType(fieldDesc, true, forItems)),
cel.Variable("this", expression.ProtoFieldToCELType(fieldDesc, true, forItems)),
cel.Variable("rules",
cel.ObjectType(string(rules.Descriptor().FullName()))),
)
Expand Down
4 changes: 2 additions & 2 deletions internal/constraints/lookups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package constraints
import (
"testing"

"github.com/bufbuild/protovalidate-go/celext"
"github.com/bufbuild/protovalidate-go/internal/expression"
"github.com/google/cel-go/cel"
"github.com/stretchr/testify/assert"
"google.golang.org/protobuf/proto"
Expand Down Expand Up @@ -84,7 +84,7 @@ func TestProtoKindToCELType(t *testing.T) {
kind, typ := k, ty
t.Run(kind.String(), func(t *testing.T) {
t.Parallel()
assert.Equal(t, typ, celext.ProtoKindToCELType(kind))
assert.Equal(t, typ, expression.ProtoKindToCELType(kind))
})
}
}
5 changes: 2 additions & 3 deletions internal/evaluator/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"sync/atomic"

"buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate"
"github.com/bufbuild/protovalidate-go/celext"
"github.com/bufbuild/protovalidate-go/internal/constraints"
"github.com/bufbuild/protovalidate-go/internal/errors"
"github.com/bufbuild/protovalidate-go/internal/expression"
Expand Down Expand Up @@ -279,9 +278,9 @@ func (bldr *Builder) processFieldExpressions(
return nil
}

celTyp := celext.ProtoFieldToCELType(fieldDesc, false, false)
celTyp := expression.ProtoFieldToCELType(fieldDesc, false, false)
opts := append(
celext.RequiredCELEnvOptions(fieldDesc),
expression.RequiredCELEnvOptions(fieldDesc),
cel.Variable("this", celTyp),
)
compiledExpressions, err := expression.Compile(exprs, bldr.env, opts...)
Expand Down
2 changes: 1 addition & 1 deletion celext/lookups.go → internal/expression/lookups.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package celext
package expression

import (
"github.com/google/cel-go/cel"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package celext
package expression

import (
"testing"
Expand Down

0 comments on commit 852ae23

Please sign in to comment.