1
1
Lua implementation of GraphQL for Tarantool
2
2
===========================================
3
3
4
- Lua implementation of GraphQL for Tarantool. It is based on [ graphql-lua] ( https://github.com/bjornbytes/graphql-lua ) .
4
+ Lua implementation of GraphQL for Tarantool.
5
+ It is based on [ graphql-lua] ( https://github.com/bjornbytes/graphql-lua ) .
5
6
6
7
7
8
Installation
8
9
------------
9
10
10
11
``` bash
11
- tarantoolctl rocks install https://github.com/raw/tarantool/ graphql/master/graphql-scm-1.rockspec
12
+ tarantoolctl rocks install graphql
12
13
```
13
14
14
15
Example
15
16
---
16
17
17
18
``` lua
18
- local parse = require ' graphql.parse'
19
- local schema = require ' graphql.schema'
20
- local types = require ' graphql.types'
21
- local validate = require ' graphql.validate'
22
- local execute = require ' graphql.execute'
19
+ local parse = require ( ' graphql.parse' )
20
+ local schema = require ( ' graphql.schema' )
21
+ local types = require ( ' graphql.types' )
22
+ local validate = require ( ' graphql.validate' )
23
+ local execute = require ( ' graphql.execute' )
23
24
24
25
-- Parse a query
25
26
local ast = parse [[
@@ -32,7 +33,7 @@ query getUser($id: ID) {
32
33
]]
33
34
34
35
-- Create a type
35
- local Person = types .object {
36
+ local Person = types .object ( {
36
37
name = ' Person' ,
37
38
fields = {
38
39
id = types .id .nonNull ,
@@ -41,11 +42,11 @@ local Person = types.object {
41
42
lastName = types .string .nonNull ,
42
43
age = types .int .nonNull
43
44
}
44
- }
45
+ })
45
46
46
47
-- Create a schema
47
- local schema = schema .create {
48
- query = types .object {
48
+ local schema = schema .create ( {
49
+ query = types .object ( {
49
50
name = ' Query' ,
50
51
fields = {
51
52
person = {
@@ -65,8 +66,8 @@ local schema = schema.create {
65
66
end
66
67
}
67
68
}
68
- }
69
- }
69
+ })
70
+ })
70
71
71
72
-- Validate a parsed query against a schema
72
73
validate (schema , ast )
@@ -91,21 +92,20 @@ execute(schema, ast, rootValue, variables, operationName)
91
92
Status
92
93
---
93
94
94
- - [x] Parsing
95
- - [ ] Improve error messages
95
+ - [x] Parsing (based on [ luagraphqlparser] ( https://github.com/tarantool/luagraphqlparser ) )
96
96
- [x] Type system
97
97
- [x] Introspection
98
98
- [x] Validation
99
99
- [x] Execution
100
100
- [ ] Asynchronous execution (coroutines)
101
- - [ ] Example server
102
101
103
102
Running tests
104
103
---
105
104
106
105
``` bash
107
- tarantoolctl rocks make # optionally
108
- tarantool tests/runner.lua
106
+ tarantoolctl rocks make
107
+ tarantoolctl rocks install luatest 0.5.2
108
+ .rocks/bin/luatest
109
109
```
110
110
111
111
License
0 commit comments