From 96a159a26f1d8628aaa41cdb98191ef917f99366 Mon Sep 17 00:00:00 2001 From: Dave New Date: Tue, 18 Feb 2025 14:24:41 +0200 Subject: [PATCH] fix: attrs setup --- schema/attributes/computed.go | 2 -- schema/attributes/permission.go | 10 ++++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/schema/attributes/computed.go b/schema/attributes/computed.go index ce40ae185..1e4caa24b 100644 --- a/schema/attributes/computed.go +++ b/schema/attributes/computed.go @@ -24,13 +24,11 @@ func defaultComputed(schema []*parser.AST) (*expressions.Parser, error) { } opts := []expressions.Option{ - options.WithCtx(), options.WithSchemaTypes(schema), options.WithComparisonOperators(), options.WithLogicalOperators(), options.WithArithmeticOperators(), options.WithFunctions(), - options.WithReturnTypeAssertion(parser.FieldTypeBoolean, false), } parser, err := expressions.NewParser(opts...) diff --git a/schema/attributes/permission.go b/schema/attributes/permission.go index a2a7b3cd6..58a9315a2 100644 --- a/schema/attributes/permission.go +++ b/schema/attributes/permission.go @@ -52,17 +52,15 @@ func ValidatePermissionExpression(schema []*parser.AST, model *parser.ModelNode, opts := []expressions.Option{} - operands, err := resolve.IdentOperands(expression) - if err != nil { - return nil, err - } + operands, _ := resolve.IdentOperands(expression) - if action != nil { + if action != nil && operands != nil { + out: for _, operand := range operands { for _, input := range action.Inputs { if operand.Fragments[0] == input.Name() { opts = append(opts, options.WithActionInputs(schema, action)) - break + break out } } }