Skip to content

Commit

Permalink
Clean up & clippy lint
Browse files Browse the repository at this point in the history
  • Loading branch information
juhaku committed Mar 16, 2023
1 parent f7dfff8 commit 43d3457
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
19 changes: 1 addition & 18 deletions utoipa-gen/src/component/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,25 +369,8 @@ impl ToTokens for NamedStructSchema<'_> {
.property(#name, #property)
});

// Named struct field is considered required if
// * it does not have `skip_serializing_if` property
// * and it does not have `serde_with` douple_option
// * and it does not have default value provided with serde `default`
// attribute
if let Property::Schema(_) = property {
if !field_rule
.as_ref()
.map(|rule| rule.skip_serializing_if)
.unwrap_or(false)
&& !field_rule
.as_ref()
.map(|rule| rule.double_option)
.unwrap_or(false)
&& !super::is_default(
&container_rules.as_ref(),
&field_rule.as_ref(),
)
{
if super::is_required(field_rule.as_ref(), container_rules.as_ref()) {
object_tokens.extend(quote! {
.required(#name)
})
Expand Down
2 changes: 1 addition & 1 deletion utoipa/src/openapi/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,7 @@ mod tests {
}

fn get_json_path<'a>(value: &'a Value, path: &str) -> &'a Value {
path.split('.').into_iter().fold(value, |acc, fragment| {
path.split('.').fold(value, |acc, fragment| {
acc.get(fragment).unwrap_or(&serde_json::value::Value::Null)
})
}
Expand Down

0 comments on commit 43d3457

Please sign in to comment.