Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve parse error for is <string-lit> #1252

Open
3 tasks done
john-h-kastner-aws opened this issue Oct 1, 2024 · 0 comments
Open
3 tasks done

Improve parse error for is <string-lit> #1252

john-h-kastner-aws opened this issue Oct 1, 2024 · 0 comments
Labels
papercut Small annoyances in the Cedar SDK. Lower priority fixes than bugs. Smaller than a fature request

Comments

@john-h-kastner-aws
Copy link
Contributor

Before opening, please confirm:

Bug Category

Cedar Parser

Describe the bug

Parsing the policy permit(principal, action, resource) when { principal is "User" }; gives the error

[jkastner@dev-dsk-jkastner-1a-3309db3b cedar]$ cargo run -q check-parse <<<'permit(principal, action, resource) 
when { principal is "User" };'
  × failed to parse policy set
  ╰─▶ right hand side of an `is` expression must be an entity type name, but got `User`
   ╭────
 1 │ permit(principal, action, resource) when { principal is "User" };
   ·                                                         ──────
   ╰────
  help: try using `==` to test for equality

This error should be more useful:

  1. In the message text User should be rendered as a string "User"
  2. The try using `==` to test equality help text is not so useful because in this case it's just a likely that they meant to drop the quotes for principal is User.

Expected behavior

.

Reproduction steps

.

Code Snippet

// Put your code below this line.

Log output

// Put your output below this line

Additional configuration

No response

Operating System

No response

Additional information and screenshots

No response

@john-h-kastner-aws john-h-kastner-aws added backlog papercut Small annoyances in the Cedar SDK. Lower priority fixes than bugs. Smaller than a fature request labels Oct 1, 2024
@john-h-kastner-aws john-h-kastner-aws changed the title Improve parse error if is <string-lit> Improve parse error for is <string-lit> Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
papercut Small annoyances in the Cedar SDK. Lower priority fixes than bugs. Smaller than a fature request
Projects
None yet
Development

No branches or pull requests

1 participant