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

Add serde feature to allow for serializing and deserializing different structs #1439

Open
1 of 2 tasks
a0js opened this issue Jan 22, 2025 · 1 comment
Open
1 of 2 tasks
Labels
feature-request This issue requets a substantial new feature

Comments

@a0js
Copy link

a0js commented Jan 22, 2025

Category

User level API features/changes

Describe the feature you'd like to request

I often find myself running from_str() on different structs like Entities, EntityTypeNames, and EntityUids. Often these are done from structured data. It would be really cool if there was a serde feature added to the cedar-policy crate that allowed for serialization and deserialization.

Example:

#[derive(Debug, Deserialize, Serialize)]
struct Message {
    entity_id: EntityId,
    entity_type: EntityTypeName,
    operation: Operation,
    timestamp: DateTime<Utc>,
    event_id: Uuid
}

Being able to deserialize the incoming message directly to an EntityId and EntityTypeName via the serde deserialize trait would be so nice.

Describe alternatives you've considered

At this point I just have to specify the entity_id and entity_type fields as Strings and perform the appropriate from_str() functions.

Additional context

No response

Is this something that you'd be interested in working on?

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change
@a0js a0js added feature-request This issue requets a substantial new feature pending-triage The cedar maintainers haven't looked at this yet. Automicaly added to all new issues. labels Jan 22, 2025
@shaobo-he-aws shaobo-he-aws added pending-review A Cedar maintainer has looked at this, but believes it needs review by more of the core team and removed pending-triage The cedar maintainers haven't looked at this yet. Automicaly added to all new issues. labels Jan 22, 2025
@shaobo-he-aws
Copy link
Contributor

Thank you for your interest in Cedar. We're discussing the serialization format internally and will let you know the results.

@shaobo-he-aws shaobo-he-aws removed the pending-review A Cedar maintainer has looked at this, but believes it needs review by more of the core team label Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request This issue requets a substantial new feature
Projects
None yet
Development

No branches or pull requests

2 participants