-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add serialization to JSON/protobuf to CLI (#1326)
Signed-off-by: Andrew Wells <[email protected]>
- Loading branch information
1 parent
264db6e
commit 3166f9b
Showing
9 changed files
with
1,007 additions
and
10 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
fn main() { | ||
#[cfg(feature = "protobufs")] | ||
generate_schemas(); | ||
} | ||
|
||
/// Reads protobuf schema files (.proto) and generates Rust modules | ||
#[cfg(feature = "protobufs")] | ||
fn generate_schemas() { | ||
let mut config = prost_build::Config::new(); | ||
config.extern_path(".cedar_policy_core", "crate::cedar_policy_core::ast::proto"); | ||
config.extern_path( | ||
".cedar_policy_validator", | ||
"crate::cedar_policy_validator::proto", | ||
); | ||
// PANIC SAFETY: compile-time unwrap | ||
#[allow(clippy::unwrap_used)] | ||
config | ||
.compile_protos(&["protobuf_schema/CLI.proto"], &["protobuf_schema"]) | ||
.unwrap(); | ||
} |
Oops, something went wrong.