Skip to content

Commit a38b205

Browse files
authored
Fixed validation of list-type variable default values (#8526)
1 parent 4202f7e commit a38b205

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

src/HotChocolate/Core/src/Validation/Rules/ValueVisitor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ protected override ISyntaxVisitorAction Enter(
103103
node.Type.NamedType().Name.Value,
104104
out var variableType))
105105
{
106-
context.Types.Push(variableType);
106+
context.Types.Push(node.Type.RewriteToType(variableType));
107107
return base.Enter(node, context);
108108
}
109109

src/HotChocolate/Core/test/Validation.Tests/ValuesOfCorrectTypeRuleTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,6 +1174,7 @@ query WithDefaultValues(
11741174
$b: String = "ok",
11751175
$c: Complex3Input = { requiredField: true, intField: 3 }
11761176
$d: Int! = 123
1177+
$e: [String!]! = ["default"]
11771178
) {
11781179
dog { name }
11791180
}

src/HotChocolate/Core/test/Validation.Tests/__snapshots__/ValuesOfCorrectTypeRuleTests.BadVariablesListWithInvalidItem.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"Extensions": {
1313
"variable": "a",
1414
"variableType": "[String]",
15-
"locationType": "String",
15+
"locationType": "[String]",
1616
"specifiedBy": "https://spec.graphql.org/October2021/#sec-Values-of-Correct-Type"
1717
},
1818
"Exception": null

0 commit comments

Comments
 (0)