Commit Graph

27 Commits

Author SHA1 Message Date
Dmitrii Skurikhin
8503c0f288 enhance query errors 2022-02-16 08:58:16 +01:00
Dmitrii Skurikhin
1f7bd92d11 fix index position in error path 2022-01-07 08:31:47 +01:00
116aa1f6bb
Put JSON support behind a flag 2021-12-24 13:35:18 +01:00
eedab9e742
Don't append a trailing newline in gql 2021-09-22 08:50:20 +02:00
60d1167839
Test nullability on value completion 2021-09-17 10:01:14 +02:00
b96d75f447
Replace the old executor 2021-09-03 22:47:49 +02:00
7b4c7e2b8c
Handle argument locations 2021-09-02 08:45:23 +02:00
233a58094d
Adjust value completion tests 2021-09-01 09:27:12 +02:00
b580d1a988
Attach the field location to resolver exceptions 2021-06-27 13:42:58 +02:00
96bb061666
Fail with a location for result coercion
The intermediate representation was further modified so that the
operation definitions contain location information. Probably I should
introduce a data type that generalizes fields and operations, so it
contains object type, location and the selection set, so the functions
don't accept so many arguments.
2021-06-24 09:29:24 +02:00
812f6967d4
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).
2021-06-22 09:13:27 +02:00
6fe9eb72e4
Fix merging fields with arguments
executeField shouldn't assume that a selection has only one field with a
given name, but it should take the first field. The underlying cause is
a wrong pattern, which (because of the laziness) is executed only if the
field has arguments.
2021-06-18 06:51:14 +02:00
2ce2be5d91
Provide location information for interface errors 2021-06-17 08:15:27 +02:00
c311cb0070
Add constructor with additional schema types 2021-05-13 17:40:38 +02:00
1b7cd85216
Add location information to the intermediate tree 2021-05-12 06:51:59 +02:00
0d23df3da2
Provide an internal function to add errors
The old function, addErrMsg, takes only a string with an error
description, but more information is required for the execution errors:
locations and path. addErrMsg should be deprecated after the switching
to the new addError.
2021-05-09 12:42:02 +02:00
7c0b0ace4d Collect types once the schema is created 2020-10-07 05:24:51 +02:00
4602eb1df3 Validate arguments are defined 2020-09-28 07:06:15 +02:00
08998dbd93 Validate fragments don't form cycles 2020-09-11 08:03:49 +02:00
09135c581a Constrain base monad to MonadCatch
Let's try MonadThrow/MonadCatch. It looks nice at a first glance. The
monad transformer stack contains only the ReaderT, less lifts are
required. Exception subtyping is easier, the user can (and should)
define custom error types and throw them. And it is still possible to
use pure error handling, if someone doesn't like runtime exceptions or
need to run a query in a pure environment.

Fixes #42.
2020-07-17 07:05:03 +02:00
e24386402b Respect subscriptions in the executor
After the last commit there were a few places needed to be adjusted to
support subscriptions. This is done and a test case is added.

It is important to implement subscriptions now, because they require
changes to the library API, and they are a big missing part to finish
the executor. When the executor is finished, we can start to provide
more stable API without breaking everything every release. Validation
and introspection shouldn't require much changes to the API; AST would
require some changes to report good errors after the validation - this
is one thing I can think of.

Fixes #5.
2020-07-15 19:15:31 +02:00
ae2210f659 Support subscriptions
This is experimental support.
The implementation is based on conduit and is boring. There is a new
resolver data constructor that should create a source event stream. The
executor receives the events, pipes them through the normal execution
and puts them into the response stream which is returned to the user.

- Tests are missing.
- The executor should check field value resolver on subscription types.
- The graphql function should probably return (Either
  ResponseEventStream Response), but I'm not sure about this. It will
  make the usage more complicated if no subscriptions are involved, but
  with the current API implementing subscriptions is more
  difficult than it should be.
2020-07-14 19:37:56 +02:00
a6f9cec413 Handle errors using custom types
Fixes #32.
2020-07-05 14:36:00 +02:00
705e506c13 Combine Resolver and ActionT in ResolverT 2020-06-29 13:14:23 +02:00
882276a845 Coerce result
Fixes #45.
2020-06-13 07:20:19 +02:00
e8c54810f8 Merge selection sets 2020-06-12 07:58:08 +02:00
c37b9c88b1 Skip unknown fields 2020-06-10 11:42:00 +02:00