Conversation
|
Todo: double check we have tests that ensure that type validation disallows |
| if (sup.ResolvedType is NonNullGraphType sup2) | ||
| { | ||
| // >> - Let {nullableItemLocationType} be the unwrapped nullable type of {itemLocationType}. | ||
| // >> - Return {AreTypesCompatible(variableType, nullableItemLocationType)}. | ||
| return IsSubtypeOf(maybeSubType, sup2); | ||
| } | ||
| else | ||
| { | ||
| // >> - Otherwise, return {AreTypesCompatible(variableType, itemLocationType)}. | ||
| return IsSubtypeOf(maybeSubType, sup.ResolvedType!, allowScalarsForLists); | ||
| } |
Check notice
Code scanning / CodeQL
Missed ternary opportunity
|
Todo: fix final failing test to prevent allowing null for a non-null input object field |
| [InlineData("query q10 { dummyList(arg: null) }", null, | ||
| "Argument 'arg' has invalid value. Expected '!', found null.")] | ||
| [InlineData("query q11 { dummyNestedList(arg: null) }", null, | ||
| "Argument 'arg' has invalid value. Expected '!', found null.")] |
There was a problem hiding this comment.
These error messages could be cleaned up.
Codecov Report
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. @@ Coverage Diff @@
## master #3662 +/- ##
==========================================
+ Coverage 84.14% 84.24% +0.09%
==========================================
Files 409 410 +1
Lines 18234 18523 +289
Branches 2856 2909 +53
==========================================
+ Hits 15343 15604 +261
- Misses 2215 2236 +21
- Partials 676 683 +7
|
|
@sungam3r This PR contains bug fixes for type validation of variables:
It also allows passing
I will merge this shortly unless you have comments. |
See:
Sample query which would fail validation:
where
dummyArgwas defined as[String]. However, these scenarios worked correctly:and
where variables were:
{ "arg": "test" }Now the original query at the top passes validation and works as described in the GraphQL spec.
Note that the spec is slightly in conflict with the description of rule All Variable Usages Are Allowed.
See:
This PR also fixes some out-of-spec behavior during coercion of arguments that have default values:
And I added a lot more tests to cover various of these scenarios.