Skip to content

Commit

Permalink
downcast from Type! to Type
Browse files Browse the repository at this point in the history
  • Loading branch information
burner committed Sep 2, 2020
1 parent 92e3f08 commit 64a7e8b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions source/graphql/validation/schemabased.d
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ class SchemaValidator(Schema) : Visitor {
}

override void enter(const(Argument) arg) {
import std.algorithm.searching : find;
import std.algorithm.searching : find, endsWith;
const argName = arg.name.value;
if(this.directiveStack.empty) {
const parent = this.schemaStack[$ - 2];
Expand Down Expand Up @@ -286,7 +286,10 @@ class SchemaValidator(Schema) : Visitor {

string typeStr = astTypeToString(*varType);
enforce!VariableInputTypeMismatch(
argElem.front[Constants.typenameOrig] == typeStr,
argElem.front[Constants.typenameOrig] == typeStr
|| (typeStr.endsWith("!")
&& typeStr[0 .. $ - 1] == argElem.front[Constants.typenameOrig])
,
format("Variable type '%s' does not match argument type '%s'"
, argElem.front[Constants.typenameOrig], typeStr));
}
Expand Down

0 comments on commit 64a7e8b

Please sign in to comment.