Fix values not being coerced to lists #6
No reviewers
Labels
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: OSS/graphql#6
Loading…
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-depends
option.But as for main issue, I still don't see what it fixes. So I wrote a test, involving the
Language.GraphQL.graphql
functions 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
extractArgumentValue
passing 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
coerceInputLiteral
doesn't get called in the first place, as the pattern match in thecoerceArgumentValue
function 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
coerceInputLiteral
to 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)97d304d283
toa1cda38e20
You're absolutely right, thanks.
I'll add your and my tests in a later commit.