diff options
| author | Eugen Wissner <belka@caraus.de> | 2021-06-22 09:13:27 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2021-06-22 09:13:27 +0200 |
| commit | 812f6967d40cfd1d1c0af5512496ff7b7cb0f6ae (patch) | |
| tree | 5e9c63a901c975a33adec2945c9b8ad5371a0ff5 /tests | |
| parent | 6fe9eb72e42fb4ae36435324148e8f96e871a26c (diff) | |
| download | graphql-812f6967d40cfd1d1c0af5512496ff7b7cb0f6ae.tar.gz | |
Provide locations for argument errors
The executor still doesn't give an error per argument, but a single
error per field with locations for all arguments.
If a non-null argument isn't specified, only the error location of the
field is given. If some arguments cannot be coerced, only the locations
of these arguments are given, non-null arguments are ignored. This
should still be improved, so the executor returns all errors at once.
The transformation tree is changed, so that argument map contains
locations of the arguments (but not the locations of the argument values
yet).
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/Language/GraphQL/ExecuteSpec.hs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/Language/GraphQL/ExecuteSpec.hs b/tests/Language/GraphQL/ExecuteSpec.hs index a31b0a2..5e86848 100644 --- a/tests/Language/GraphQL/ExecuteSpec.hs +++ b/tests/Language/GraphQL/ExecuteSpec.hs @@ -254,6 +254,20 @@ spec = $ parse document "" "{ philosopher { majorWork { title } } }" in actual `shouldBe` expected + it "gives location information for invalid scalar arguments" $ + let data'' = Aeson.object + [ "philosopher" .= Aeson.Null + ] + executionErrors = pure $ Error + { message = "Argument coercing failed." + , locations = [Location 1 15] + , path = [] + } + expected = Response data'' executionErrors + Right (Right actual) = either (pure . parseError) execute' + $ parse document "" "{ philosopher(id: true) { lastName } }" + in actual `shouldBe` expected + context "Subscription" $ it "subscribes" $ let data'' = Aeson.object |
