@@ -928,6 +928,7 @@ void ValidateExecutableVisitor::visitOperationDefinition(const peg::ast_node& op
928
928
}
929
929
930
930
variableArgument.defaultValue = true ;
931
+ variableArgument.nonNullDefaultValue = argument.value != nullptr ;
931
932
}
932
933
}
933
934
@@ -1068,6 +1069,8 @@ ValidateTypeFieldArguments ValidateExecutableVisitor::getArguments(response::Lis
1068
1069
1069
1070
argument.defaultValue = (itrDefaultValue != members.end ()
1070
1071
&& itrDefaultValue->second .type () == response::Type::String);
1072
+ argument.nonNullDefaultValue = argument.defaultValue
1073
+ && itrDefaultValue->second .get <response::StringType>() != R"gql( null)gql" ;
1071
1074
argument.type = std::move (itrType->second );
1072
1075
1073
1076
result[itrName->second .release <response::StringType>()] = std::move (argument);
@@ -1159,7 +1162,7 @@ bool ValidateExecutableVisitor::validateInputValue(bool hasNonNullDefaultValue,
1159
1162
1160
1163
_referencedVariables.insert (variable.name );
1161
1164
1162
- return validateVariableType (hasNonNullDefaultValue || itrVariable->second .defaultValue , itrVariable->second .type , argument.position , type);
1165
+ return validateVariableType (hasNonNullDefaultValue || itrVariable->second .nonNullDefaultValue , itrVariable->second .type , argument.position , type);
1163
1166
}
1164
1167
else
1165
1168
{
@@ -1299,7 +1302,7 @@ bool ValidateExecutableVisitor::validateInputValue(bool hasNonNullDefaultValue,
1299
1302
if (entry.second .value
1300
1303
|| !itrField->second .defaultValue )
1301
1304
{
1302
- if (!validateInputValue (itrField->second .defaultValue , entry.second , itrField->second .type ))
1305
+ if (!validateInputValue (itrField->second .nonNullDefaultValue , entry.second , itrField->second .type ))
1303
1306
{
1304
1307
// Error messages are added in the recursive call, so just bubble up the result.
1305
1308
return false ;
@@ -2210,7 +2213,7 @@ void ValidateExecutableVisitor::visitField(const peg::ast_node& field)
2210
2213
&& itrArgument->second .value )
2211
2214
{
2212
2215
// The value was not null.
2213
- if (!validateInputValue (argument.second .defaultValue , itrArgument->second , argument.second .type ))
2216
+ if (!validateInputValue (argument.second .nonNullDefaultValue , itrArgument->second , argument.second .type ))
2214
2217
{
2215
2218
// http://spec.graphql.org/June2018/#sec-Values-of-Correct-Type
2216
2219
std::ostringstream message;
@@ -2588,7 +2591,7 @@ void ValidateExecutableVisitor::visitDirectives(introspection::DirectiveLocation
2588
2591
&& itrArgument->second .value )
2589
2592
{
2590
2593
// The value was not null.
2591
- if (!validateInputValue (argument.second .defaultValue , itrArgument->second , argument.second .type ))
2594
+ if (!validateInputValue (argument.second .nonNullDefaultValue , itrArgument->second , argument.second .type ))
2592
2595
{
2593
2596
// http://spec.graphql.org/June2018/#sec-Values-of-Correct-Type
2594
2597
std::ostringstream message;
0 commit comments