This commit is contained in:
parent
82761736ce
commit
c650713997
4 changed files with 38 additions and 2 deletions
|
@ -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)
|
||||
|
||||
|
|
|
@ -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)),
|
||||
|
|
|
@ -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>(
|
||||
|
|
|
@ -666,6 +666,9 @@ where
|
|||
registry
|
||||
.field::<Option<String>>("stringListArgField", i)
|
||||
.argument(registry.arg::<Option<Vec<Option<String>>>>("stringListArg", i)),
|
||||
registry
|
||||
.field::<Option<String>>("nonNullStringListArgField", i)
|
||||
.argument(registry.arg::<Vec<String>>("nonNullStringListArg", i)),
|
||||
registry
|
||||
.field::<Option<String>>("complexArgField", i)
|
||||
.argument(registry.arg::<Option<ComplexInput>>("complexArg", i)),
|
||||
|
|
Loading…
Reference in a new issue