Commit Graph

263 Commits

Author SHA1 Message Date
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
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
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
70fbaf359e Split Character data type into Droid and Human
`Character` is now a synonym of the sum type of `Droid` and `Human`.

For now I don't see the need to implement GraphQL Schema interfaces with
type classes or lens. Plain Haskell ADTs should be good enough.
2016-02-09 14:38:19 +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
c385566912 Bump copyright year 2016-02-08 17:35:33 +01:00
Danny Navarro
781788e306 Drop support for older stackage versions 2016-02-08 17:33:51 +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
53e101f35e Simplify JSON notation in tests 2016-02-05 12:54:04 +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
a70732a4b6 Pin stack to LTS-4.2 2016-01-26 13:35:53 +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
Danny Navarro
c8f629e826 Merge pull request #2 from timmytofu/isstring-variable
`IsString` variable and .gitignore
2015-09-26 09:23:46 +02:00
timmy_tofu
85941139c1 Adds IsString instance to Variable for easier REPL playing 2015-09-25 19:12:22 -04:00
timmy_tofu
0848e65da2 Adds dist/ dir and cabal sandbox dir and file to gitignore 2015-09-25 19:11:42 -04:00
Danny Navarro
6ce2004264 Version Bump
This also includes updates to CHANGELOG, TODO and README.
2015-09-22 14:27:10 +02:00
Danny Navarro
af42e5577c Rename Data.GraphQL.Printer -> Data.GraphQL.Encoder 2015-09-22 14:23:18 +02:00
Danny Navarro
a4db99ea5d Fixes for ghc-7.8 2015-09-22 14:02:49 +02:00
Danny Navarro
06b3302862 Add kitchen sink parse/encode unit test
This also includes the fixes to make it work. Golden tests have been
removed.
2015-09-22 14:02:49 +02:00
Danny Navarro
4508364266 Fix alias colon order 2015-09-22 11:16:36 +02:00
Danny Navarro
99b4d86702 Polish printer code
- Add printing combinators to make code more readable.
- Optimize printing for encoding. Pretty printing will be in a different
  module.
2015-09-22 11:13:09 +02:00
Danny Navarro
da97387042 Parser fixes:
- Braces instead of parens for `inputValueDefinitions`.
- Rename `bool` -> `booleanValue`.
- Some code rearrangements.
2015-09-22 10:39:14 +02:00
Danny Navarro
e74ee640a8 Initial implementation of GraphQL pretty printer
This just typechecks. It needs to be cleaned and tested. Tests have been
deactivated.
2015-09-21 18:26:22 +02:00
Danny Navarro
3d97b3e2ff Introduce Node data type to simplify OperationDefinition
Thanks to @swolchok for the suggestion.
2015-09-21 10:05:09 +02:00
Danny Navarro
88ca3d1866 Add errors for all parser Alternatives 2015-09-21 09:28:51 +02:00
Danny Navarro
899fa1b531 Handle escaped quotes for GraphQL String Values
This also includes a new type for Value String.

The tests fail now, although it parses successfully. I'll use a pretty
printer in next commit so that it's easier to spot the differences.
Onces this is working I'll add the rest of the escaped characters.
2015-09-18 18:11:11 +02:00
Danny Navarro
cb9977141d Golf 2015-09-18 16:29:40 +02:00
Danny Navarro
4f4e31805a Parse secure names 2015-09-18 15:43:22 +02:00
Danny Navarro
d88acf3d0e Refine numeric types 2015-09-18 15:02:51 +02:00
Danny Navarro
c9c1137ceb Garden 2015-09-18 14:55:59 +02:00
Danny Navarro
dac6721f02 Version bump and CHANGELOG 2015-09-16 11:16:16 +02:00
Danny Navarro
b3482172a6 Add travis support 2015-09-16 10:51:53 +02:00
Danny Navarro
f88948e801 Support ghc-7.8 2015-09-16 10:36:59 +02:00
Danny Navarro
ee0e0c3d1f Use Cabal data-files to access golden tests data
Fixes #1.
2015-09-16 10:13:44 +02:00
Danny Navarro
82a380079c Version bump, CHANGELOG and some gardening 2015-09-14 17:26:09 +02:00
Danny Navarro
7cf2b59331 Version bump, CHANGELOG and some gardening 2015-09-14 17:25:18 +02:00
Danny Navarro
dcd7b46a6d Convenient imports for ghci 2015-09-14 17:02:43 +02:00
Danny Navarro
8d81f43b61 Add golden test for kitchen-sink.graphql 2015-09-14 17:01:14 +02:00
Danny Navarro
b4b8388392 Enable warnings and take care of extra imports 2015-09-14 15:48:47 +02:00