diff --git a/docs/api-reference/apidocs.swagger.json b/docs/api-reference/apidocs.swagger.json index b87a90158..d3c770e3a 100644 --- a/docs/api-reference/apidocs.swagger.json +++ b/docs/api-reference/apidocs.swagger.json @@ -3,7 +3,7 @@ "info": { "title": "Permify API", "description": "Permify is an open source authorization service for creating fine-grained and scalable authorization systems.", - "version": "v0.9.3", + "version": "v0.9.4", "contact": { "name": "API Support", "url": "https://github.com/Permify/permify/issues", diff --git a/internal/info.go b/internal/info.go index 5f9cf7c41..3257c1991 100644 --- a/internal/info.go +++ b/internal/info.go @@ -23,7 +23,7 @@ var Identifier = "" */ const ( // Version is the last release of the Permify (e.g. v0.1.0) - Version = "v0.9.3" + Version = "v0.9.4" ) // Function to create a single line of the ASCII art with centered content and color diff --git a/pkg/dsl/compiler/compiler.go b/pkg/dsl/compiler/compiler.go index 6ad2408fd..5193e31ec 100644 --- a/pkg/dsl/compiler/compiler.go +++ b/pkg/dsl/compiler/compiler.go @@ -212,7 +212,9 @@ func (t *Compiler) compileRule(sc *ast.RuleStatement) (*base.RuleDefinition, err // Compile and type-check the expression. compiledExp, issues := env.Compile(sc.Expression) if issues != nil && issues.Err() != nil { - return nil, issues.Err() + pi := sc.Name.PositionInfo + pi.LinePosition++ + return nil, compileError(pi, issues.Err().Error()) } if compiledExp.OutputType() != cel.BoolType { diff --git a/pkg/dsl/parser/parser.go b/pkg/dsl/parser/parser.go index 96b926f18..64af42001 100644 --- a/pkg/dsl/parser/parser.go +++ b/pkg/dsl/parser/parser.go @@ -345,6 +345,7 @@ func (p *Parser) parseRuleStatement() (*ast.RuleStatement, error) { } else if !p.peekTokenIs(token.RP) { // If the next token is not a comma, it must be a closing parenthesis. // If it's not, return an error. + p.peekError(token.RP) return nil, p.Error() } } @@ -367,6 +368,7 @@ func (p *Parser) parseRuleStatement() (*ast.RuleStatement, error) { for !p.peekTokenIs(token.RCB) { // If there's no closing bracket, return an error. if p.peekTokenIs(token.EOF) { + p.peekError(token.RCB) return nil, p.Error() } @@ -715,7 +717,8 @@ func (p *Parser) parseIdentifierOrCall() (ast.Expression, error) { func (p *Parser) parseIdentifierExpression() (ast.Expression, error) { // Ensure the current token is a valid identifier before proceeding. if !p.currentTokenIs(token.IDENT) { - return nil, fmt.Errorf("unexpected token type for identifier expression: %s", p.currentToken.Type) + p.currentError(token.IDENT) + return nil, p.Error() } // Create a new Identifier expression with the first token as the prefix. @@ -726,11 +729,10 @@ func (p *Parser) parseIdentifierExpression() (ast.Expression, error) { p.next() // Consume the dot token // Check if the next token after the dot is a valid identifier - if !p.peekTokenIs(token.IDENT) { - return nil, fmt.Errorf("expected identifier after dot, got %s", p.peekToken.Type) + if !p.expectAndNext(token.IDENT) { + return nil, p.Error() } - p.next() // Consume the identifier token ident.Idents = append(ident.Idents, p.currentToken) } @@ -742,7 +744,8 @@ func (p *Parser) parseIdentifierExpression() (ast.Expression, error) { func (p *Parser) parseCallExpression() (ast.Expression, error) { // Ensure the current token is a valid identifier before proceeding. if !p.currentTokenIs(token.IDENT) { - return nil, fmt.Errorf("unexpected token type for identifier expression: %s", p.currentToken.Type) + p.currentError(token.IDENT) + return nil, p.Error() } // Create a new Identifier expression with the first token as the prefix. diff --git a/pkg/pb/base/v1/openapi.pb.go b/pkg/pb/base/v1/openapi.pb.go index 1647d82bb..dc87d954a 100644 --- a/pkg/pb/base/v1/openapi.pb.go +++ b/pkg/pb/base/v1/openapi.pb.go @@ -46,7 +46,7 @@ var file_base_v1_openapi_proto_rawDesc = []byte{ 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x66, 0x79, 0x2f, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x66, 0x79, 0x2f, 0x62, 0x6c, 0x6f, 0x62, 0x2f, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x2f, 0x4c, 0x49, 0x43, 0x45, 0x4e, 0x53, 0x45, - 0x32, 0x06, 0x76, 0x30, 0x2e, 0x39, 0x2e, 0x33, 0x2a, 0x01, 0x02, 0x32, 0x10, 0x61, 0x70, 0x70, + 0x32, 0x06, 0x76, 0x30, 0x2e, 0x39, 0x2e, 0x34, 0x2a, 0x01, 0x02, 0x32, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x5a, 0x23, 0x0a, 0x21, 0x0a, 0x0a, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x41, 0x75, 0x74, 0x68, 0x12, diff --git a/proto/base/v1/openapi.proto b/proto/base/v1/openapi.proto index 24b72c835..c74c59b98 100644 --- a/proto/base/v1/openapi.proto +++ b/proto/base/v1/openapi.proto @@ -9,7 +9,7 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Permify API"; description: "Permify is an open source authorization service for creating fine-grained and scalable authorization systems."; - version: "v0.9.3"; + version: "v0.9.4"; contact: { name: "API Support"; url: "https://github.com/Permify/permify/issues";