Skip to content

Commit

Permalink
fix(torii-graphql): nullable array is empty string (#2882)
Browse files Browse the repository at this point in the history
* fix(torii-graphql): nullable array is empty string

* fmt
  • Loading branch information
Larkooo authored Jan 9, 2025
1 parent 7036164 commit 07d7595
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/torii/graphql/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ pub fn value_mapping_from_row(
TypeData::List(_) => {
let value = fetch_value(row, &column_name, "String", is_internal, snake_case)?;
if let Value::String(json_str) = value {
if json_str.is_empty() {
value_mapping.insert(Name::new(field_name), Value::List(vec![]));
continue;
}

let mut array_value: Value =
serde_json::from_str(&json_str).map_err(|e| {
sqlx::Error::Protocol(format!("JSON parse error: {}", e))
Expand Down

0 comments on commit 07d7595

Please sign in to comment.