Skip to content

Commit

Permalink
Fixed string literals in places of enum values have to raise a query …
Browse files Browse the repository at this point in the history
…errors. (#2846)
  • Loading branch information
PascalSenn authored Jan 13, 2021
1 parent 1dc6ca0 commit bb459e3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/HotChocolate/Core/src/Validation/Rules/ValueVisitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,12 @@ private bool IsInstanceOfType(
return true;
}

if (inputType.IsEnumType() &&
value is StringValueNode)
{
return false;
}

return internalType.IsInstanceOfType(value);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -619,8 +619,7 @@ public void BadFloatIntoEnum()
");
}

// is this something that we find ok or should we change it back?
[Fact(Skip = "We do allow this at the moment.")]
[Fact]
public void BadStringIntoEnum()
{
ExpectErrors(@"
Expand Down

0 comments on commit bb459e3

Please sign in to comment.