hodei-derive

Crates.iohodei-derive
lib.rshodei-derive
version0.1.0
created_at2025-10-17 20:56:06.512096+00
updated_at2025-10-17 20:56:06.512096+00
descriptionDerive macros for Hodei authorization framework - auto-generate Cedar schemas
homepagehttps://github.com/Rubentxu/hodei-policies
repositoryhttps://github.com/Rubentxu/hodei-policies
max_upload_size
id1888414
size20,034
Ruben Dario (Rubentxu)

documentation

https://docs.rs/hodei-derive

README

hodei-derive

Derive macros for the Hodei authorization framework.

Overview

This crate provides procedural macros to automatically generate Cedar Policy schemas from Rust types:

  • #[derive(HodeiEntity)] - Generate entity schemas
  • #[derive(HodeiAction)] - Generate action schemas

Usage

use hodei_derive::{HodeiEntity, HodeiAction};
use hodei_hrn::Hrn;

#[derive(HodeiEntity)]
#[hodei(entity_type = "MyApp::User")]
struct User {
    id: Hrn,
    email: String,
    role: String,
}

#[derive(HodeiAction)]
#[hodei(namespace = "MyApp")]
enum DocumentAction {
    #[hodei(principal = "User", resource = "Document")]
    Read,
    
    #[hodei(principal = "User", resource = "Document")]
    Update,
}

Features

  • Auto-generate Cedar schemas from Rust types
  • Type-safe authorization at compile time
  • Inventory integration for schema discovery
  • Zero runtime overhead

Documentation

For more information, see the Hodei documentation.

License

Licensed under either of:

at your option.

Commit count: 0

cargo fmt