Commit Graph

76 Commits

Author SHA1 Message Date
ae4038eb47 Restore error handling 2019-06-27 08:00:59 +02:00
2172de3729 Enable mutations 2019-06-23 05:38:45 +02:00
5e9bf9648d Parse queries with megaparsec 2019-06-21 10:44:58 +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
fb071210cf
Fix wrong scientific exponent when parsing 2017-03-03 15:23:43 -03:00
Danny Navarro
6a10e28ba8
Garden 2017-03-01 16:05:49 -03:00
Danny Navarro
5954962de1
Make alternate Schema functions work with AST.Core 2017-03-01 16:04:35 -03:00
Danny Navarro
1327bcf7f7
Merge pull request #20 from Lupino/master 2017-03-01 15:13:20 -03:00
Danny Navarro
e521d92c7f
Use builtin scientific toBoundInteger to check for Int32 bounds 2017-02-28 17:22:06 -03:00
Danny Navarro
1b8fca3658
Merge branch 'core'
This introduces a distinction between a Full and a Core AST. Fragments and
variables are replaced when transforming from Full to Core.
2017-02-28 16:07:00 -03:00
Danny Navarro
bada28ce24
Simplify fragment substitution 2017-02-24 16:46:51 -03:00
Danny Navarro
d2c138f8d1
Add basic Fragment Support
Only field names are supported for now.
2017-02-23 15:29:58 -03:00
Lupino
3be86bf69e Enable Monad for array and object resolver
When I use facebook/haxl, I can not find any way to the sub resolver.
so I add Monad resolver to support it.
2017-02-23 11:08:47 +08:00
Danny Navarro
39731ff233
Fix parsing of Named Types 2017-02-13 15:31:56 -03:00
Danny Navarro
b7a72591fd
Support variables in AST transformation 2017-02-13 15:19:13 -03:00
Danny Navarro
e716bc57e7
Wrap executed result in "data" object 2017-02-10 17:10:09 -03:00
Danny Navarro
4ab4660d36
Initial implementation of AST.Full -> AST.Core
This focused mainly on fragments.
2017-02-10 15:00:22 -03:00
Danny Navarro
8b09c8aa76
Make operation name optional 2017-02-03 12:57:21 -03:00
Danny Navarro
693b7d18dc
Introduce Tranform module
In the Transform module the Full AST will converted to Core AST.

This commit also includes a partial implementation of Fragment replacement.
2017-02-02 12:44:03 -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
jasonzoladz
140c7df6fb Fix Int32 bounds checking in Value parser. 2017-01-28 12:06:28 -05:00
Danny Navarro
3e991adf4e
Add Graphql Core AST 2017-01-26 12:52:07 -03:00
Danny Navarro
10fdf05aa7
Remove Type Definition support 2017-01-26 11:56:22 -03:00
Danny Navarro
933cfd2852
Tokenize number parser
The essential change hidden behind the code golfing is using the `tok`
combinator. This was making fail the Kitchen Sink test.
2016-12-18 12:19:59 -03:00
Tom Hunger
87c92e9d6e Parse number as scientific and interpret meaning separately.
The current parser will fail parsing floats because it parses an int,
and then stumbles on the dot.

To fix I interpret the value with the scientific library which already
is a dependency through attoparsec, so we're not introducing any extra
downloads or compiling.

I think this is still subtly wrong because "10.0" will be parsed as
ValueInt, but because input argument ints are allowed to be coerced
into doubles (according to the spec) this is probably acceptable.
2016-12-09 00:03:20 +00:00
Danny Navarro
61f0a06096
Drop support for GHC-7.8.4 2016-11-27 12:56:44 -03:00
Danny Navarro
77853b17ae Merge branch 'all-improvements'
This adds general API documentation, a tutorial and error handling.
2016-03-15 14:02:34 +01:00
solrun
61d6af7778 Added documentation of functions and modules and included tutorial.lhs. 2016-03-14 01:42:55 +01: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
a6b2fd297b Garden 2016-02-17 13:20:56 +01:00
Danny Navarro
7131d1c142 Initial support for aliases in execute 2016-02-17 13:20:56 +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
a088c81944 Handle Field arguments in Schema definition
The `Schema` has been overhauled to make `Output` monomorphic.
Traversing the `GraphQL` document is handled implicitly while defining
the `Schema`.

The 4th end-to-end test from `graphql-js` has been ported.
2016-02-12 12:51:18 +01:00
Danny Navarro
df8e43c9aa Handle Output enumerations in Schema definition
The third end-to-end test from graphql-js was implemented.
2016-02-09 13:31:28 +01:00
Danny Navarro
1561e62489 Extend execute for deeper queries
The second graphql-js end-to-end test was ported and passed
successfully.
2016-02-08 17:30:18 +01:00
Danny Navarro
c81ddb0335 Introduce graphql function
This simplifies Attoparsec parsing when executing a GraphQL
query.
2016-02-05 12:32:35 +01:00
Danny Navarro
eca3c2d8d4 Generalize Maybe type constructor to any Monad
This allows schema definitions with side-effects for any type with a
Monadic/Alternative implementation like IO for example.
2016-01-30 12:29:49 +01:00
Danny Navarro
a832991ac0 Remove unnecessary import 2016-01-27 18:52:20 +01:00
Danny Navarro
b72cfc097a Fix for GHC-7.8.4 2016-01-26 13:57:58 +01:00
Danny Navarro
78e0d871d5 Garden 2016-01-26 13:38:02 +01:00
Danny Navarro
bb685c9afa Rough implementation of execute
The first end-to-end test taken from `graphql-js` passes but this still
needs to be extended to support more general cases.

- `Data.GraphQL.Schema` has been heavily modified to support the
  execution model. More drastic changes are expected in this module.
- When defining a `Schema` ordinary functions taking fields as input are
  being used instead of maps. This makes the implementation of `execute`
  easier, and, arguably, makes `Schema` definitions more *Haskellish*.
- Drop explicit `unordered-containers` dependency. `Aeson.Value`s and
  field functions should be good enough for now.
2016-01-26 12:43:18 +01:00
Danny Navarro
4e5dc3433a Implement first StarWars end-to-end test
`execute` still needs to be implemented.
2015-10-19 12:19:39 +02:00
Danny Navarro
3f30a44d1d Test fixtures for Schema toplevel
This includes simplications to the Schema data types.
2015-10-17 17:49:56 +02:00
Danny Navarro
8e3bae4b5c Initial stub for a GraphQL and execute 2015-10-17 13:23:49 +02:00
timmy_tofu
85941139c1 Adds IsString instance to Variable for easier REPL playing 2015-09-25 19:12:22 -04:00
Danny Navarro
af42e5577c Rename Data.GraphQL.Printer -> Data.GraphQL.Encoder 2015-09-22 14:23:18 +02:00