Skip to content

Commit

Permalink
Fixes #1192
Browse files Browse the repository at this point in the history
  • Loading branch information
sunli829 committed Jan 3, 2023
1 parent e2e35ce commit 4f6e472
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/dynamic/resolve.rs
Expand Up @@ -367,7 +367,7 @@ pub(crate) fn resolve<'a>(
(TypeRefInner::List(_), Some(_)) => Err(ctx.set_error_path(
Error::new("internal: expects an array").into_server_error(ctx.item.pos),
)),
(TypeRefInner::List(_), None) => Ok(Some(Value::List(vec![]))),
(TypeRefInner::List(_), None) => Ok(None),
}
}
.boxed()
Expand Down
8 changes: 7 additions & 1 deletion src/dynamic/schema.rs
Expand Up @@ -749,6 +749,11 @@ mod tests {
])))
})
},
))
.field(Field::new(
"values3",
TypeRef::named_nn_list(TypeRef::INT),
|_| FieldFuture::new(async { Ok(None::<Vec<Value>>) }),
));
let schema = Schema::build("Query", None, None)
.register(query)
Expand All @@ -757,14 +762,15 @@ mod tests {

assert_eq!(
schema
.execute("{ values values2 }")
.execute("{ values values2 values3 }")
.await
.into_result()
.unwrap()
.data,
value!({
"values": [3, 6, 9],
"values2": [3, 6, 9],
"values3": null,
})
);
}
Expand Down

0 comments on commit 4f6e472

Please sign in to comment.