diff --git a/juniper/CHANGELOG.md b/juniper/CHANGELOG.md
index 7d10f41e..921b700c 100644
--- a/juniper/CHANGELOG.md
+++ b/juniper/CHANGELOG.md
@@ -1,6 +1,6 @@
# master
-- No changes yet
+- Fix incorrect error when explicit `null` provided for `null`able list input parameter. ([#1086](https://github.com/graphql-rust/juniper/pull/1086))
# [[0.15.9] 2022-02-02](https://github.com/graphql-rust/juniper/releases/tag/juniper-v0.15.9)
diff --git a/juniper/src/types/utilities.rs b/juniper/src/types/utilities.rs
index 74271e77..f8213671 100644
--- a/juniper/src/types/utilities.rs
+++ b/juniper/src/types/utilities.rs
@@ -25,6 +25,7 @@ where
}
}
TypeType::List(ref inner) => match *arg_value {
+ InputValue::Null | InputValue::Variable(_) => true,
InputValue::List(ref items) => items
.iter()
.all(|i| is_valid_literal_value(schema, inner, &i.item)),
diff --git a/juniper/src/validation/rules/arguments_of_correct_type.rs b/juniper/src/validation/rules/arguments_of_correct_type.rs
index 495ca4f7..6356d27a 100644
--- a/juniper/src/validation/rules/arguments_of_correct_type.rs
+++ b/juniper/src/validation/rules/arguments_of_correct_type.rs
@@ -85,7 +85,7 @@ mod tests {
};
#[test]
- fn good_null_value() {
+ fn null_into_nullable_int() {
expect_passes_rule::<_, _, DefaultScalarValue>(
factory,
r#"
@@ -98,6 +98,20 @@ mod tests {
);
}
+ #[test]
+ fn null_into_nullable_list() {
+ expect_passes_rule::<_, _, DefaultScalarValue>(
+ factory,
+ r#"
+ {
+ complicatedArgs {
+ stringListArgField(stringListArg: null)
+ }
+ }
+ "#,
+ );
+ }
+
#[test]
fn null_into_int() {
expect_fails_rule::<_, _, DefaultScalarValue>(
@@ -116,6 +130,24 @@ mod tests {
);
}
+ #[test]
+ fn null_into_list() {
+ expect_fails_rule::<_, _, DefaultScalarValue>(
+ factory,
+ r#"
+ {
+ complicatedArgs {
+ nonNullStringListArgField(nonNullStringListArg: null)
+ }
+ }
+ "#,
+ &[RuleError::new(
+ &error_message("nonNullStringListArg", "[String!]!"),
+ &[SourcePosition::new(111, 3, 64)],
+ )],
+ );
+ }
+
#[test]
fn good_int_value() {
expect_passes_rule::<_, _, DefaultScalarValue>(
diff --git a/juniper/src/validation/test_harness.rs b/juniper/src/validation/test_harness.rs
index a7ff1429..810759ed 100644
--- a/juniper/src/validation/test_harness.rs
+++ b/juniper/src/validation/test_harness.rs
@@ -666,6 +666,9 @@ where
registry
.field::