Skip to content

Commit

Permalink
Fix source name error field name
Browse files Browse the repository at this point in the history
  • Loading branch information
tinrab committed Feb 5, 2024
1 parent 6f0ba22 commit 256d718
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions bomboni_request/src/parse/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,14 @@ mod tests {
}};
}

assert_parse_field_err!(
Item {
string: String::new(),
..Default::default()
},
"string",
&CommonError::RequiredFieldMissing
);
assert_parse_field_err!(
Item {
required_string: String::new(),
Expand Down
4 changes: 3 additions & 1 deletion bomboni_request_derive/src/parse/message/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,9 @@ fn expand_parse_field(options: &ParseOptions, field: &ParseField) -> syn::Result
));
}

let field_name = if let Some(name) = field.name.as_ref() {
let field_name = if let Some(source_name) = field.source_name.as_ref() {
quote!(#source_name)
} else if let Some(name) = field.name.as_ref() {
quote! { #name }
} else {
field
Expand Down

0 comments on commit 256d718

Please sign in to comment.