Skip to content

Macros for entity/object conversion #986

@shaobo-he-aws

Description

@shaobo-he-aws

Category

User level API features/changes

Describe the feature you'd like to request

Derive macros on Rust structs that generate methods to convert them to/from entities. This is akin to ORM. For instance,

#[derive(Cedar)]
struct Team {
  #[eid]
  id: String,
  members: HashSet<Member>
}
#[derive(Cedar)]
struct Member {
  #[eid]
  id: String,
  location: String,
}

Team { id: "t0", member: [Member {id: "m0", location: "USA"}, Member {id: "m1", location: "CAN"}]} gets converted to entities {Team::"t0": { "member": [Member::"m0", Member::"m1"]}, Member::"m0": {...}, Member::"m1": {...}.

Describe alternatives you've considered

N/A

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestThis issue requets a substantial new featurerequires-RFCThis issue requests a substanial change to the Cedar langauge which needs to follow the RFC process

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions