Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
124 changes: 53 additions & 71 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ members = [
]

[workspace.package]
edition = "2021"
rust-version = "1.83"
edition = "2024"
rust-version = "1.95"
license = "Apache-2.0 OR MIT"
authors = ["Mathematic Inc"]
repository = "https://github.com/mathematic-inc/protovalidate-buffa"
Expand All @@ -24,8 +24,8 @@ pedantic = { level = "deny", priority = -1 }
nursery = { level = "deny", priority = -1 }

[patch.crates-io]
buffa = { git = "https://github.com/anthropics/buffa", rev = "b065d14dbd545a25ba30974384e505b4bc072771" }
buffa-types = { git = "https://github.com/anthropics/buffa", rev = "b065d14dbd545a25ba30974384e505b4bc072771" }
buffa-codegen = { git = "https://github.com/anthropics/buffa", rev = "b065d14dbd545a25ba30974384e505b4bc072771" }
buffa-build = { git = "https://github.com/anthropics/buffa", rev = "b065d14dbd545a25ba30974384e505b4bc072771" }
buffa-descriptor = { git = "https://github.com/anthropics/buffa", rev = "b065d14dbd545a25ba30974384e505b4bc072771" }
buffa = { git = "https://github.com/anthropics/buffa", rev = "4c264ddd6fdd286f237dac0551fd420907b4864c" }
buffa-types = { git = "https://github.com/anthropics/buffa", rev = "4c264ddd6fdd286f237dac0551fd420907b4864c" }
buffa-codegen = { git = "https://github.com/anthropics/buffa", rev = "4c264ddd6fdd286f237dac0551fd420907b4864c" }
buffa-build = { git = "https://github.com/anthropics/buffa", rev = "4c264ddd6fdd286f237dac0551fd420907b4864c" }
buffa-descriptor = { git = "https://github.com/anthropics/buffa", rev = "4c264ddd6fdd286f237dac0551fd420907b4864c" }
4 changes: 2 additions & 2 deletions crates/protoc-gen-protovalidate-buffa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ name = "protoc-gen-protovalidate-buffa"
path = "src/main.rs"

[dependencies]
buffa = "0.4"
buffa-codegen = "0.4"
buffa = "0.5"
buffa-codegen = "0.5"
protovalidate-buffa-protos = { path = "../protovalidate-buffa-protos", version = "0.1.2" }
proc-macro2 = "1"
quote = "1"
Expand Down
16 changes: 8 additions & 8 deletions crates/protoc-gen-protovalidate-buffa/src/emit/cel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ pub fn emit_message_level(msg: &MessageValidators) -> (Vec<TokenStream>, Vec<Tok
if matches!(f.ignore, crate::scan::Ignore::Always) {
continue;
}
if let crate::scan::FieldKind::Message { full_name } = &f.field_type {
if full_name.starts_with("google.protobuf.") {
continue;
}
if let crate::scan::FieldKind::Message { full_name } = &f.field_type
&& full_name.starts_with("google.protobuf.")
{
continue;
}
let field_ident = format_ident!("{}", f.field_name);
let field_name = &f.field_name;
Expand Down Expand Up @@ -116,7 +116,7 @@ pub fn emit_message_level(msg: &MessageValidators) -> (Vec<TokenStream>, Vec<Tok
}
}
crate::scan::FieldKind::Optional(_) => quote! {
if let Some(ref v) = self.#field_ident {
if let Some(v) = &self.#field_ident {
if let Err(viol) = #ident.#method(
::protovalidate_buffa::cel::to_cel_value(v),
#fp,
Expand Down Expand Up @@ -493,7 +493,7 @@ pub fn emit_as_cel_value(msg: &MessageValidators, rust_path: &Path) -> Result<To
// skip the insert when unset so CEL's has() reports false.
match &f.field_type {
FieldKind::Optional(_) => quote! {
if let Some(ref v) = self.#field_ident {
if let Some(v) = &self.#field_ident {
map.insert(
::std::string::String::from(#field_name),
::protovalidate_buffa::cel::to_cel_value(v),
Expand Down Expand Up @@ -574,8 +574,8 @@ fn field_to_cel_value_expr(f: &FieldValidator, field_ident: &syn::Ident) -> Toke
FieldKind::Optional(_) => {
// EXPLICIT-presence scalar: `Option<T>`. Map None→Null, Some(v)→to_cel_value.
quote! {
match self.#field_ident {
Some(ref v) => ::protovalidate_buffa::cel::to_cel_value(v),
match &self.#field_ident {
Some(v) => ::protovalidate_buffa::cel::to_cel_value(v),
None => ::protovalidate_buffa::cel_core::Value::Null,
}
}
Expand Down
Loading
Loading