eslint-plugin-graphql
eslint-plugin-graphql copied to clipboard
Missing Non-Null marked input type not detected
trafficstars
Intended outcome:
Detect that resendUserVerificationInput is supposed to be Non-Null in this query:
#import "fragments/mutationResponseFields.gql"
mutation ResendVerification($input: resendUserVerificationInput) {
resendUserVerification(input: $input) {
resendUserVerification {
user {
id
phoneNumber
}
...mutationResponseFields
}
}
}
The same query in Graphiql yields this error:

Actual outcome:
No error is detected when linting
How to reproduce the issue:
If I introduce a deliberate error e.g. misspell resendUserVerificationInput above errors are properly detected:
/Users/jacob/Code/foo/app/containers/ResendVerification/resendVerification.gql
4:37 error Unknown type "resendUserVerificationInputs". Did you mean "resendUserVerificationInput" or "resendUserVerificationPayload"? graphql/template-strings
My graphql/template-strings configuration:
"graphql/template-strings": [
"error",
{
"env": "literal",
"schemaJsonFilepath": "app/schema.json",
"validators": [
"ArgumentsOfCorrectType",
"DefaultValuesOfCorrectType",
"FieldsOnCorrectType",
"FragmentsOnCompositeTypes",
"KnownArgumentNames",
"KnownTypeNames",
"LoneAnonymousOperation",
"NoFragmentCycles",
"NoUndefinedVariables",
"NoUnusedVariables",
"OverlappingFieldsCanBeMerged",
"PossibleFragmentSpreads",
"ProvidedNonNullArguments",
"ScalarLeafs",
"UniqueArgumentNames",
"UniqueFragmentNames",
"UniqueInputFieldNames",
"UniqueOperationNames",
"UniqueVariableNames",
"VariablesAreInputTypes"
]
}
]
Excerpt from schema.json for related mutation indicating non null:
{
"args" : [ {
"defaultValue" : null,
"name" : "input",
"description" : null,
"type" : {
"kind" : "NON_NULL",
"name" : null,
"ofType" : {
"kind" : "INPUT_OBJECT",
"name" : "resendUserVerificationInput",
"ofType" : null
}
}
} ],
"deprecationReason" : null,
"isDeprecated" : false,
"name" : "resendUserVerification",
"description" : "resendUserVerification",
"type" : {
"kind" : "OBJECT",
"name" : "resendUserVerificationPayload",
"ofType" : null
}
}
I had the same thing today-this is not marked as a problem:

even though my schema has attending arg as nullable.
Yet it works when I mismatch type for userId:
