mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-02-23 15:49:49 +01:00
fix(rust): teach remove_json_null_values arrays
change `remove_json_null_values()` to properly remove nulls from and recurse in to arrays google_firestore1_beta1's `CommitRequest` contains an array of `Write` objects which can ultimately contain `Value` members that need to have nulls removed to avoid sending multiple types of values which generates a 400 response fixes calls to google_firestore1_beta1's `hub.projects().databases_documents_commit()`
This commit is contained in:
committed by
Sebastian Thiel
parent
6d0f4cac7c
commit
499416c011
@@ -746,6 +746,17 @@ pub fn remove_json_null_values(value: &mut json::value::Value) {
|
||||
map.remove(key);
|
||||
}
|
||||
}
|
||||
json::value::Value::Array(ref mut arr) => {
|
||||
let mut i = 0;
|
||||
while i < arr.len() {
|
||||
if arr[i].is_null() {
|
||||
arr.remove(i);
|
||||
} else {
|
||||
remove_json_null_values(&mut arr[i]);
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user