Commit Graph

88 Commits

Author SHA1 Message Date
Eugen Wissner e8b82122c6 Try all extension parsers 2020-01-28 11:08:28 +01:00
Eugen Wissner b4a3c98114 Parse schema extensions 2020-01-25 16:45:39 +01:00
Eugen Wissner 3ef27f9d11 Add "extend symbol" lexer to parse extensions 2020-01-17 12:29:06 +01:00
Eugen Wissner ba710a3c96 Parse complete TypeSystemDefinition 2020-01-15 20:20:50 +01:00
Eugen Wissner d257d05d4e Parse enum and input object type definitions 2020-01-13 08:21:02 +01:00
Eugen Wissner adffa185bb Parse interface type definition 2020-01-13 08:21:02 +01:00
Eugen Wissner f4ed06741d Parse union definitions 2020-01-13 08:21:02 +01:00
Eugen Wissner 8efb08fda1 Parse ObjectDefinition 2020-01-13 08:21:02 +01:00
Eugen Wissner d9a2937b55 Parse SchemaDefinition 2020-01-13 08:18:30 +01:00
Eugen Wissner d82d5a36b3 Retrieve resolver arguments from the reader 2019-12-31 08:29:03 +01:00
Eugen Wissner 44dc80bb37 Replace substitution function with a map
It makes using variables with queries more approachable, but some work
still has to be done.
- The type `Subs` should be renamed and moved out of `Schema`, together with
`AST.Core.Value` probably.
- Some kind of conversion should be possible from a user-defined input
type T to the Value. So the final HashMap should have a type like
`HashMap name a`, where a is an instance of a potential typeclass
InputType.
2019-12-30 18:26:24 +01:00
Eugen Wissner fdf5914626 Move AST to AST.Document 2019-12-28 07:07:58 +01:00
Eugen Wissner 62f3c34bfe Replace AST.Selection data constructors 2019-12-25 06:45:29 +01:00
Eugen Wissner b215e1a4a7 Pretify multi-line string arguments as block strings
Fixes #10.
2019-12-21 09:25:05 +01:00
Eugen Wissner 1e55f17e7e Encode Unicode. Fix #34 2019-12-20 07:58:09 +01:00
Eugen Wissner 9a5d54c035 Escape non-source characters in the encoder 2019-12-19 06:59:27 +01:00
Eugen Wissner 3c1a5c800f Support directives (skip and include)
Fixes #24.
2019-12-06 22:52:24 +01:00
Eugen Wissner fc9ad9c4a1 Consider __typename when evaluating fragments
Fixes #30.
2019-12-02 07:43:19 +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
Eugen Wissner 115aa02672 Fail on cyclic fragments, fix #22 2019-11-14 20:40:09 +01:00
Eugen Wissner 31c516927d Support nested fragments in any order
Fix #19.
2019-11-12 10:47:10 +01:00
Eugen Wissner 1dd6b7b013 Support nested fragments
... without forward lookup.
2019-11-09 23:24:31 +01:00
Eugen Wissner 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
Eugen Wissner c7d5b02911 Handle top-level fragments
Fixes #17.
2019-10-19 10:00:25 +02:00
Eugen Wissner 37254c8c95 Inline fragments without type
Fixes #11.
2019-10-11 23:28:55 +02:00
Eugen Wissner 856efc5d25 Support inline fragments on types 2019-10-08 09:03:07 +02:00
Eugen Wissner eb98c36258 Introduce hspec-megaparsec
Fixes #13.
2019-09-27 10:50:38 +02:00
Eugen Wissner c075a41582 Add pending inline fragment tests 2019-09-13 20:33:39 +02:00
Eugen Wissner 1704022e74 Fix #12 2019-09-06 07:48:01 +02:00
Eugen Wissner 63d4de485d Deprecate enum, enumA, wrappedEnum, wrappedEnumA
These functions are from Language.GraphQL.Schema.
There are actually only two generic types in GraphQL: Scalars and objects.
Enum is a scalar value. According to the specification enums may be
serailized to strings. And in the current implementation they used
untyped strings anyway, so there is no point to have differently named
functions with the same implementation as their scalar counterparts.
2019-09-01 03:16:27 +02:00
Eugen Wissner 22313d05df Deprecate Language.GraphQL.Execute.Schema
It is not a schema (at least not a complete one), but a resolver list,
and the resolvers should be provided by the user separately, because the
schema can originate from a GraphQL document. Schema name should be free
to provide a data type for the real schema later.
2019-08-30 07:26:04 +02:00
Eugen Wissner 045b6d15fb Escape special characters in the encoded strings
Fixes #2.
2019-08-13 07:24:05 +02:00
Eugen Wissner a3354e7f58 Make all encoder functions return lazy text 2019-08-05 09:00:11 +02:00
Eugen Wissner 7a8a90aba8 Implement indentation in the encoder 2019-08-03 23:57:27 +02:00
Eugen Wissner 989e418cc2 Put spaces between tokens in the pretty printer 2019-08-02 13:52:51 +02:00
Eugen Wissner 4812c8f039 Introduce formatter type for the encoder
... to distinguish between minified and pretty printing.
2019-07-31 05:40:17 +02:00
Eugen Wissner d690d22ce8 Test the encoder with the unminified document 2019-07-27 07:31:09 +02:00
Eugen Wissner 282946560e Add singleError utility function 2019-07-23 07:22:32 +02:00
Eugen Wissner 1b5094b6a3 Parse the BOM header if any 2019-07-22 05:50:00 +02:00
Eugen Wissner f3b8d9b74c Make all exports explicit 2019-07-14 05:58:05 +02:00
Eugen Wissner eb40810f25 Replace tasty and HUnit with Hspec 2019-07-10 05:57:35 +02:00
Eugen Wissner 61879fb124 Constrain the resolvers with MonadIO
This replaces the most usages of MonadPlus, which is not appropriate for
the resolvers, since a resolver is unambiguously chosen by the name (no
need for 'mplus'), and the resolvers are often doing IO.
2019-07-08 10:15:47 +02:00
Eugen Wissner 22d4a4e583 Change the main namespace to Language.GraphQL 2019-07-07 06:31:53 +02:00
Eugen Wissner d7b6fd0329 Allow resolvers to return arbitrary nested lists 2019-07-05 20:05:04 +02:00
Eugen Wissner 6238b2fbfa Add nullable types 2019-07-03 17:54:50 +02:00
Eugen Wissner 91679650b5 Introduce monad transformer for resolvers
Now the errors in the resolvers can be handled and 3 tests throwing
errors pass now. Another test fail but it requires distinguisching
nullable and non-nullable values.
2019-07-02 20:07:26 +02:00
Eugen Wissner 79c734fa62 Replace Alternative with MonadPlus 2019-06-28 11:12:28 +02:00
Eugen Wissner ae4038eb47 Restore error handling 2019-06-27 08:00:59 +02:00
Eugen Wissner 3cc38343db Fix ambigious Int resolution in the lexer tests 2019-06-26 15:41:30 +02:00