-
-
Notifications
You must be signed in to change notification settings - Fork 748
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type validation doesn't work for string arguments when using variables #714
Comments
@michaelstaib any way we can get a fix for this in 0.8.x? We're experiencing this issue in a production environment. |
Yes we could create 0.8.3. I will have a look at it tonight. |
I moved this now to a hotfix release. We have another issue that we want to fix quickly and I think we can do that quickly. Version 9 is still two weeks out. |
The issue is now partially fixed with 9.0.0-preview.23. So, with this build lists and objects are no longer allowed and will lead to an exception. With scalars it is more difficult and I am still figuring out how we should go about it. The problem here is that we convert scalars when they do not match. This is useful if we have something like a short and we want to add that as a value for an int. When we have this completely fixed in the V9 branch then we will port it back to the V8 branch. |
I can see the conversion being useful for |
@gregsdennis I totally agree on the with you... I am just evaluation how we fix it without breaking custom scalars. |
@michaelstaib any updates on this? |
Not yet, but we will fix it with version 9.1. We will start on bug fixing at the end of 9.1. |
We are now starting on bug fixing .... this one will be on 9.1.0-preview.25. |
I have fixed this one now.... I will write a couple more tests and then merge it next week into 10.0.0-rc.1. |
There seems to be a problem with the type validation when an argument is of GQL type
String
and you're passing the value in from a variable.To Reproduce
I have attached a solution that replicates the issue: HotChocolateTypeValidationBug.zip
Run this solution and then execute the following queries:
This correctly fails, reporting that the
stringData
argument is invalid.This incorrectly executes without error.
Expected behavior
I expect that both versions would produce the error.
Desktop (please complete the following information):
Additional context
Debugging into my query, it appears that the
false
value is being converted into a string containing "false" then passed to my method.Interestingly, if I use
{"stringData":5}
, I get a "5" in the method parameter, but if I use{"stringData":{"test":"string"}}
, aNullReferenceException
is thrown from within HotChocolate:I'm using schema-first here. I'm not sure if this problem exists for code-first. I expect it probably does.
The text was updated successfully, but these errors were encountered: