-
Notifications
You must be signed in to change notification settings - Fork 107
Use human friendly type format for type error display #708
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
Conversation
ce0154b
to
eb0298b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a couple minor comments. This will make error messages much more readable!
/// Convert a custom type AST into the JSON representation of the type. | ||
/// Conversion is done in an empty context. | ||
pub fn custom_type_to_json_type(ty: Node<Type>) -> Result<SchemaType, ToJsonSchemaErrors> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why "custom" type? Isn't it just the internal Cedar type?
(Context: I was confused by the name at first because I was trying to figure out how it related to commonType
definitions in the JSON / type
declarations in the new schema syntax)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just copied the phrasing from another function in this file. We could perhaps do a consistency pass so that we call the new schema format one name everywhere.
// complete schema. TODO: the final stage of schema parsing already does | ||
// this. Can we remove duplicated checks from human schema parsing? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to address this TODO in the PR, or file an issue for later & add the issue number to the comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's not necessarily an easy change. #711
Fix #242 Signed-off-by: John Kastner <[email protected]>
Signed-off-by: John Kastner <[email protected]>
eb0298b
to
8cd9427
Compare
Signed-off-by: John Kastner <[email protected]>
Signed-off-by: John Kastner <[email protected]>
Fix #242
This required a way to print out internal types that aren't accepted by the parser. I used a namespace
__cedar::internal
for this, so, for example, a type error that expects any set will say that it expectsSet<__cedar::internal::Any>
.Description of changes
Issue #, if available
Checklist for requesting a review
The change in this PR is (choose one, and delete the other options):
cedar-policy
.I confirm that this PR (choose one, and delete the other options):
I confirm that
cedar-spec
(choose one, and delete the other options):Disclaimer
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.