Commit Graph

38 Commits

Author SHA1 Message Date
7cd4821718 Don't fail on invalid fragments and variables 2020-05-23 21:49:57 +02:00
c3ecfece03 Coerce variable values 2020-05-21 10:20:59 +02:00
a5c44f30fa Add basic output object type support 2020-05-14 22:16:56 +02:00
500cff20eb Separate Query and Mutation resolvers
Fixes #33 .
2020-05-10 18:32:58 +02:00
613e929d91 Update to Stack 15.x 2020-02-20 05:16:14 +01:00
67bebf853c Replace MonadIO constraint with just Monad
And make the tests use Identity instead of IO.
2020-02-01 20:46:35 +01:00
d82d5a36b3 Retrieve resolver arguments from the reader 2019-12-31 08:29:03 +01:00
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
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
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
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
f3b8d9b74c Make all exports explicit 2019-07-14 05:58:05 +02:00
eb40810f25 Replace tasty and HUnit with Hspec 2019-07-10 05:57:35 +02:00
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
22d4a4e583 Change the main namespace to Language.GraphQL 2019-07-07 06:31:53 +02:00
d7b6fd0329 Allow resolvers to return arbitrary nested lists 2019-07-05 20:05:04 +02:00
6238b2fbfa Add nullable types 2019-07-03 17:54:50 +02:00
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
79c734fa62 Replace Alternative with MonadPlus 2019-06-28 11:12:28 +02:00
ae4038eb47 Restore error handling 2019-06-27 08:00:59 +02:00
Danny Navarro
2b5648efda
When argument is not found return null
The relevant test was restored too.
2017-03-03 17:02:19 -03:00
Danny Navarro
285ccb0af9
Implement type instrospection tests
The main intention with this commit is to show a poor's man way to support type
instrospection.
2017-03-01 17:04:13 -03:00
Danny Navarro
d2c138f8d1
Add basic Fragment Support
Only field names are supported for now.
2017-02-23 15:29:58 -03:00
Danny Navarro
f35e1f949a
Define Schema using Core AST
Also, temporarily remove error reporting to simplify execution. This should be
restored once the new execution model is nailed.
2017-01-30 15:20:17 -03:00
Danny Navarro
5390c4ca1e
Split AST in 2
One AST is meant to be a target parser and tries to adhere as much as possible
to the spec. The other is a simplified version of that AST meant for execution.

Also newtypes have been replaced by type synonyms and NonEmpty lists are being
used where it makes sense.
2017-01-28 14:15:14 -03:00
Danny Navarro
aa66236081
Add homePlanet to test schema 2016-12-18 11:43:45 -03:00
Pweaver (Paul Weaver)
a6c0d63049 add tests for errors in queries for queries in starwars tests 2016-07-08 18:10:14 -04:00
Pweaver (Paul Weaver)
624efbbb35 adds __typename tests to starwars testfile 2016-07-08 16:51:54 -04:00
Pweaver (Paul Weaver)
cb73e9d53c adds the starwars tests for fragments
Also refactors some deplicate objects into a where clause
2016-07-08 16:11:03 -04:00
Matthías Páll Gissurarson
d195389102 Added exception handling with Alternative constraint according to spec. 2016-03-14 01:01:24 +01:00
Danny Navarro
d8a731fe30 Remove StringValue type 2016-02-22 13:59:38 +01:00
Danny Navarro
770df82718 Simplify Schema definition API
Now there is one `Resolver` type and the `Output` and `Scalar` types
have been removed. This should be closer to the final Schema definition
API.
2016-02-19 19:21:32 +01:00
Danny Navarro
8ee50727bd Overhaul Schema DSL
Aside of making the definition of Schemas easier, it takes care of
issues like nested aliases which previously wasn't possible. The naming
of the DSL functions is still provisional.
2016-02-18 13:49:02 +01:00
Danny Navarro
7131d1c142 Initial support for aliases in execute 2016-02-17 13:20:56 +01:00
Danny Navarro
a0f12455c5 Add remaining tests with variables in arguments
The test with invalid ID is commented out until proper exception
handling is implemented.
2016-02-17 12:35:54 +01:00
Danny Navarro
98d2d41cda Initial support for variable substitution
The correspondent end-to-end test has been ported. The variable
definition still needs to be checked.
2016-02-15 14:43:52 +01:00
Danny Navarro
119f94b38e Clean up StarWars test queries 2016-02-15 11:19:05 +01:00
Danny Navarro
04d8d40b3a Split StarWars tests in different modules 2016-02-12 13:27:46 +01:00