Fix values not being coerced to lists #6
Reference in New Issue
Block a user
No description provided.
Delete Branch "prescientmoon/graphql:master"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #5
Thanks for the pull request. I will definitly accept some parts of its as the change to
graphql.cabal, didn't know there is abuild-tool-dependsoption.But as for main issue, I still don't see what it fixes. So I wrote a test, involving the
Language.GraphQL.graphqlfunctions which performs all parts of the GraphQL, validation and execution, and the tests pass already in master.Actually the coercion of values to lists happens in
Language.GraphQL.Coerce.coerceInputLiteral:Besides that there seem to be other problems like
extractArgumentValuepassing variable values tocoerceInputLiteral. Variables and their types in GraphQL are passed separatelyquery($myVariable: MyType) {…}and they are validated separately (inLanguage.GraphQL.Execute.coerceVairableValues) and if I'm not mistaken, it's how the specification describes the process.Probalby I'm overseeing something obvious, but I need a test case, that shows that the current implementation violates the specification.
@belka Here is a simplified test showing the error (only the second test passes):
The issue is that
coerceInputLiteraldoesn't get called in the first place, as the pattern match in thecoerceArgumentValuefunction only works if the type and the value are bothList.Your test works because you are using scalar types, which do indeed call
coerceInputLiteral.Fixing this would require the logic in
coerceInputLiteralto essentially be duplicated tocoerceArgumentValue, hence me trying to get rid of the latter. I'm not very familiar with the internals of this library, so I might be missing something important (in which case, feel free to fix this in a better manner)97d304d283toa1cda38e20You're absolutely right, thanks.
I'll add your and my tests in a later commit.