Commit Graph

98 Commits

Author SHA1 Message Date
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
840e129c44 Parse subscriptions 2020-07-11 06:34:10 +02:00
28781586a5 Parse comments in the front of definitions 2020-07-09 08:11:12 +02:00
c9e265f72c Return parser error location in a list
An error can have multiple locations which are returned in a listt with
key "locations".
2020-07-08 08:17:55 +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
91bd2d0d81 Fix list input coercion 2020-06-19 10:53:41 +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
377c87045e Add description to the enum type values 2020-06-07 06:16:45 +02:00
4c9264c12c Coerce argument values properly
Fixes #44.
2020-06-06 21:22:11 +02:00
d12577ae71 Define resolvers on type fields
Returning resolvers from other resolvers isn't supported anymore. Since
we have a type system now, we define the resolvers in the object type
fields and pass an object with the previous result to them.
2020-05-29 13:53:51 +02:00
61dbe6c728 Split input/output types and values into 2 modules 2020-05-25 07:41:21 +02:00
eb90a4091c Check point 2020-05-24 13:51:00 +02:00
7cd4821718 Don't fail on invalid fragments and variables 2020-05-23 21:49:57 +02:00
26cc53ce06 Reject variables as default values 2020-05-22 10:11:48 +02:00
c3ecfece03 Coerce variable values 2020-05-21 10:20:59 +02:00
4c19c88e98 Accept resolvers given by the user as is 2020-05-13 16:21:48 +02:00
Dmitrii Skurikhin
2760bd8ee1 Don't encode controls as block strings
Fixes #39.

String containing control sequences should be encoded as simple strings
even if they contain newlines, since the block strings can contain only
SourceCharacters.
2020-04-10 11:19:36 +02:00
Dmitrii Skurikhin
30d6a0a58d encode null value as "null" 2020-03-31 10:04:34 +03:00
e8b82122c6 Try all extension parsers 2020-01-28 11:08:28 +01:00
b4a3c98114 Parse schema extensions 2020-01-25 16:45:39 +01:00
3ef27f9d11 Add "extend symbol" lexer to parse extensions 2020-01-17 12:29:06 +01:00
ba710a3c96 Parse complete TypeSystemDefinition 2020-01-15 20:20:50 +01:00
d257d05d4e Parse enum and input object type definitions 2020-01-13 08:21:02 +01:00
adffa185bb Parse interface type definition 2020-01-13 08:21:02 +01:00
f4ed06741d Parse union definitions 2020-01-13 08:21:02 +01:00
8efb08fda1 Parse ObjectDefinition 2020-01-13 08:21:02 +01:00
d9a2937b55 Parse SchemaDefinition 2020-01-13 08:18:30 +01:00
fdf5914626 Move AST to AST.Document 2019-12-28 07:07:58 +01:00
62f3c34bfe Replace AST.Selection data constructors 2019-12-25 06:45:29 +01:00
b215e1a4a7 Pretify multi-line string arguments as block strings
Fixes #10.
2019-12-21 09:25:05 +01:00
1e55f17e7e Encode Unicode. Fix #34 2019-12-20 07:58:09 +01:00
9a5d54c035 Escape non-source characters in the encoder 2019-12-19 06:59:27 +01:00
Sam Nolan
def52ddc20 Fix strings not consuming spaces
Fixes #28
2019-11-28 19:09:26 +11:00
Sam Nolan
73e21661b4 Fix failed parsing on multiple required arguments
Fixes #25.
2019-11-21 08:51:42 +01:00
73fc334bf8 Move related modules to Language.GraphQL.AST
Fixes #18.

- `Language.GraphQL.Encoder` moved to `Language.GraphQL.AST.Encoder`.
- `Language.GraphQL.Parser` moved to `Language.GraphQL.AST.Parser`.
- `Language.GraphQL.Lexer` moved to `Language.GraphQL.AST.Lexer`.
- All `Language.GraphQL.AST.Value` data constructor prefixes were removed. The
  module should be imported qualified.
- All `Language.GraphQL.AST.Core.Value` data constructor prefixes were removed.
  The module should be imported qualified.
- `Language.GraphQL.AST.Transform` is now isn't exposed publically anymore.
2019-11-03 11:00:18 +01:00
eb98c36258 Introduce hspec-megaparsec
Fixes #13.
2019-09-27 10:50:38 +02:00
1704022e74 Fix #12 2019-09-06 07:48:01 +02:00
045b6d15fb Escape special characters in the encoded strings
Fixes #2.
2019-08-13 07:24:05 +02:00
282946560e Add singleError utility function 2019-07-23 07:22:32 +02:00
1b5094b6a3 Parse the BOM header if any 2019-07-22 05:50:00 +02:00
eb40810f25 Replace tasty and HUnit with Hspec 2019-07-10 05:57:35 +02:00
3cc38343db Fix ambigious Int resolution in the lexer tests 2019-06-26 15:41:30 +02:00
5e9bf9648d Parse queries with megaparsec 2019-06-21 10:44:58 +02:00