Skip to content

Commit c871d40

Browse files
committed
fixed crud validation
1 parent ead602d commit c871d40

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

ffi/doo_ffi_http/src/crud.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,11 @@ fn fetch_item_by_id(resource: &str, id: i64) -> Option<serde_json::Value> {
103103
/// Check if a struct has at least one field decorated with @primary.
104104
fn struct_has_primary(struct_name: &str) -> bool {
105105
crate::metadata::get_struct_metadata(struct_name)
106-
.map(|meta| meta.fields.iter().any(|f| f.decorators.iter().any(|d| d == "primary")))
106+
.map(|meta| {
107+
meta.fields
108+
.iter()
109+
.any(|f| f.decorators.iter().any(|d| d == "primary"))
110+
})
107111
.unwrap_or(false)
108112
}
109113

ffi/doo_ffi_http/src/validation.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ pub(crate) fn validate_item_against_schema(
7979
}
8080

8181
// Validate JSON value type matches Doo field type
82-
if let Err(e) = validate_field_type(&field_meta.field_type, &field_meta.name, value, path) {
82+
if let Err(e) =
83+
validate_field_type(&field_meta.field_type, &field_meta.name, value, path)
84+
{
8385
return Err(e);
8486
}
8587

0 commit comments

Comments
 (0)