Skip to content

Commit

Permalink
Merge pull request #1317 from Permify/next
Browse files Browse the repository at this point in the history
fix: playground bugs
  • Loading branch information
tolgaOzen authored Jun 25, 2024
2 parents 0238e2a + 14ea596 commit 75b9608
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/api-reference/apidocs.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion internal/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion pkg/dsl/compiler/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
13 changes: 8 additions & 5 deletions pkg/dsl/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
Expand All @@ -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()
}

Expand Down Expand Up @@ -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.
Expand All @@ -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)
}

Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion pkg/pb/base/v1/openapi.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion proto/base/v1/openapi.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 75b9608

Please sign in to comment.