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

Finalize v4.0 JSON FFI #1014

Merged
merged 7 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cedar-policy/src/api/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ impl From<PolicyId> for ast::PolicyID {
/// Identifier for a Template slot
#[repr(transparent)]
#[allow(clippy::module_name_repetitions)]
#[derive(Debug, Clone, Eq, PartialEq, PartialOrd, Ord, Hash, RefCast)]
#[derive(Debug, Clone, Eq, PartialEq, PartialOrd, Ord, Hash, RefCast, Serialize, Deserialize)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deny_unknown_fields?

Does repr(transparent) imply serde(transparent)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll make sure denny_unknown_fields gets added as part of #1041 (assuming this PR is merged first)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then my question is just, should we also have serde(transparent)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, didn't answer that part. From a quick google search: I'm not sure. Slot ids are definitely de/serializing like I'd expect (?principal and ?resource), so I don't think adding serde(transparent) will change anything, but maybe I should add it to be safe?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure either. As long as we have tests to catch regressions, I think we're fine without it

pub struct SlotId(ast::SlotId);

impl SlotId {
Expand Down
Loading
Loading