gql 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -4
- data/lib/gql/config.rb +1 -1
- data/lib/gql/errors.rb +30 -7
- data/lib/gql/executor.rb +1 -1
- data/lib/gql/parser.rb +115 -107
- data/lib/gql/schema/call.rb +1 -2
- data/lib/gql/schema/field.rb +0 -1
- data/lib/gql/schema/list.rb +1 -0
- data/lib/gql/schema/parameter.rb +6 -2
- data/lib/gql/schema/root.rb +6 -1
- data/lib/gql/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 741ab8b27d0f0cc62ed7881c379dfd4580895959
|
4
|
+
data.tar.gz: 0146bc92a1b05f59716c14c317e790e34c7c1f2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78191d679e231f86f72faffc00dcbe1f80c9f7b4ae97a896dd281de0f9cd0dc8f5b4564372290e9d1a158b2f874d755883d5f55652813130cf1527df7dc861e4
|
7
|
+
data.tar.gz: 64d675caa2ad670aa305848dcc93683053e1d71b01e74a3beaa075bc792e0860e49a21f7d35ec02de303892de3fcf52a813916e9b31a0c08f9197449c8a7cc08
|
data/README.md
CHANGED
@@ -155,7 +155,16 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
155
155
|
## Contributing
|
156
156
|
|
157
157
|
1. Fork it ( https://github.com/martinandert/gql/fork )
|
158
|
-
2.
|
159
|
-
3.
|
160
|
-
4.
|
161
|
-
5.
|
158
|
+
2. Run `bin/setup` to install dependencies.
|
159
|
+
3. Run the tests. We only take pull requests with passing tests, and it's great to know that you have a clean slate: `bin/rake test`.
|
160
|
+
4. Create your feature branch (`git checkout -b my-new-feature`)
|
161
|
+
5. Add a test for your change. Only refactoring and documentation changes require no new tests. If you are adding functionality or are fixing a bug, we need a test!
|
162
|
+
6. Make the test pass.
|
163
|
+
7. Commit your changes (`git commit -am 'add some feature'`)
|
164
|
+
8. Push to your fork (`git push origin my-new-feature`)
|
165
|
+
9. Create a new Pull Request
|
166
|
+
|
167
|
+
|
168
|
+
## License
|
169
|
+
|
170
|
+
Released under The MIT License.
|
data/lib/gql/config.rb
CHANGED
data/lib/gql/errors.rb
CHANGED
@@ -3,6 +3,26 @@ require 'active_support/core_ext/string/inflections'
|
|
3
3
|
|
4
4
|
module GQL
|
5
5
|
class Error < StandardError
|
6
|
+
attr_reader :code, :handle
|
7
|
+
|
8
|
+
def initialize(msg, code = 100, handle = nil)
|
9
|
+
@code, @handle = code, handle
|
10
|
+
super(msg)
|
11
|
+
end
|
12
|
+
|
13
|
+
def as_json
|
14
|
+
result = {
|
15
|
+
error: {
|
16
|
+
code: code,
|
17
|
+
type: self.class.name.split('::').last.underscore
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
result[:error][:handle] = handle.to_s if handle
|
22
|
+
result[:error][:message] = message if ENV['DEBUG']
|
23
|
+
|
24
|
+
result
|
25
|
+
end
|
6
26
|
end
|
7
27
|
|
8
28
|
module Errors
|
@@ -21,7 +41,7 @@ module GQL
|
|
21
41
|
def initialize(id, node_class)
|
22
42
|
msg = construct_message(node_class, id, 'call', :calls)
|
23
43
|
|
24
|
-
super(msg)
|
44
|
+
super(msg, 111, id)
|
25
45
|
end
|
26
46
|
end
|
27
47
|
|
@@ -29,7 +49,7 @@ module GQL
|
|
29
49
|
def initialize(id, node_class)
|
30
50
|
msg = construct_message(node_class, id, 'field', :fields)
|
31
51
|
|
32
|
-
super(msg)
|
52
|
+
super(msg, 112, id)
|
33
53
|
end
|
34
54
|
end
|
35
55
|
|
@@ -37,7 +57,7 @@ module GQL
|
|
37
57
|
def initialize(node_class, super_class)
|
38
58
|
msg = "#{node_class} must be a (subclass of) #{super_class}."
|
39
59
|
|
40
|
-
super(msg)
|
60
|
+
super(msg, 121)
|
41
61
|
end
|
42
62
|
end
|
43
63
|
|
@@ -54,7 +74,7 @@ module GQL
|
|
54
74
|
msg << "The following field types are currently registered: "
|
55
75
|
msg << GQL.field_types.keys.sort.map { |id| "`#{id}'" }.to_sentence
|
56
76
|
|
57
|
-
super(msg)
|
77
|
+
super(msg, 122)
|
58
78
|
end
|
59
79
|
end
|
60
80
|
|
@@ -63,11 +83,14 @@ module GQL
|
|
63
83
|
msg = "GQL root node class is not set. "
|
64
84
|
msg << "Set it with `GQL.root_node_class = MyRootNode'."
|
65
85
|
|
66
|
-
super(msg)
|
86
|
+
super(msg, 123)
|
67
87
|
end
|
68
88
|
end
|
69
89
|
|
70
90
|
class ScanError < Error
|
91
|
+
def initialize(msg)
|
92
|
+
super(msg, 131)
|
93
|
+
end
|
71
94
|
end
|
72
95
|
|
73
96
|
class SyntaxError < Error
|
@@ -75,7 +98,7 @@ module GQL
|
|
75
98
|
token = 'character' if token == 'error' || token == %Q{"#{value}"}
|
76
99
|
msg = "Unexpected #{token}: `#{value}' (line #{lineno})."
|
77
100
|
|
78
|
-
super(msg)
|
101
|
+
super(msg, 132, value)
|
79
102
|
end
|
80
103
|
end
|
81
104
|
|
@@ -84,7 +107,7 @@ module GQL
|
|
84
107
|
msg = "#{node_class} must have a #{name} class set. "
|
85
108
|
msg << "Set it with `self.#{name}_class = My#{name.camelize}Class'."
|
86
109
|
|
87
|
-
super(msg)
|
110
|
+
super(msg, 124)
|
88
111
|
end
|
89
112
|
end
|
90
113
|
end
|
data/lib/gql/executor.rb
CHANGED
data/lib/gql/parser.rb
CHANGED
@@ -16,7 +16,7 @@ require 'gql/tokenizer'
|
|
16
16
|
module GQL
|
17
17
|
class Parser < Racc::Parser
|
18
18
|
|
19
|
-
module_eval(<<'...end parser.racc/module_eval...', 'parser.racc',
|
19
|
+
module_eval(<<'...end parser.racc/module_eval...', 'parser.racc', 136)
|
20
20
|
|
21
21
|
class Query < Struct.new(:root, :variables)
|
22
22
|
def as_json(*)
|
@@ -81,65 +81,65 @@ module_eval(<<'...end parser.racc/module_eval...', 'parser.racc', 135)
|
|
81
81
|
racc_action_table = [
|
82
82
|
35, 31, 32, 33, 34, 35, 6, 28, 35, 31,
|
83
83
|
32, 33, 34, 51, 39, 28, 45, 29, 55, 35,
|
84
|
-
31, 32, 33, 34, 7, 29, 28, 37,
|
85
|
-
46, 38, 14, 6,
|
84
|
+
31, 32, 33, 34, 7, 29, 28, 37, 72, 6,
|
85
|
+
46, 38, 14, 6, 71, 12, 29, 35, 31, 32,
|
86
86
|
33, 34, 12, 10, 28, 35, 31, 32, 33, 34,
|
87
87
|
16, 6, 28, 12, 29, 59, 35, 31, 32, 33,
|
88
|
-
34,
|
89
|
-
|
90
|
-
12, 12,
|
88
|
+
34, 68, 29, 28, 43, 69, 39, 73, 42, 66,
|
89
|
+
67, 38, 6, 29, 12, 22, 36, 12, 43, 39,
|
90
|
+
12, 12, 12, 70, 43, 35 ]
|
91
91
|
|
92
92
|
racc_action_check = [
|
93
93
|
29, 29, 29, 29, 29, 28, 0, 29, 14, 14,
|
94
94
|
14, 14, 14, 28, 21, 14, 21, 29, 29, 22,
|
95
95
|
22, 22, 22, 22, 1, 14, 22, 18, 56, 3,
|
96
|
-
22, 18, 5, 22, 56, 6, 22,
|
97
|
-
|
98
|
-
7,
|
99
|
-
|
100
|
-
47, 60, 8,
|
101
|
-
43, 45, 54,
|
96
|
+
22, 18, 5, 22, 56, 6, 22, 67, 67, 67,
|
97
|
+
67, 67, 2, 2, 67, 70, 70, 70, 70, 70,
|
98
|
+
7, 67, 70, 39, 67, 39, 72, 72, 72, 72,
|
99
|
+
72, 52, 70, 72, 20, 52, 20, 60, 20, 47,
|
100
|
+
47, 60, 8, 72, 10, 11, 15, 38, 40, 41,
|
101
|
+
42, 43, 45, 54, 63, 69 ]
|
102
102
|
|
103
103
|
racc_action_pointer = [
|
104
104
|
-10, 24, 34, 13, nil, 17, 27, 50, 56, nil,
|
105
105
|
66, 63, nil, nil, 6, 59, nil, nil, 17, nil,
|
106
106
|
57, 5, 17, nil, nil, nil, nil, nil, 3, -2,
|
107
107
|
nil, nil, nil, nil, nil, nil, nil, nil, 69, 45,
|
108
|
-
71,
|
109
|
-
nil, nil, 51, nil,
|
110
|
-
57, nil,
|
111
|
-
nil, 54, nil, nil, nil, nil, nil, nil ]
|
108
|
+
71, 70, 72, 73, nil, 74, nil, 56, nil, nil,
|
109
|
+
nil, nil, 51, nil, 65, nil, 14, nil, nil, nil,
|
110
|
+
57, nil, nil, 77, nil, nil, nil, 35, nil, 83,
|
111
|
+
43, nil, 54, nil, nil, nil, nil, nil, nil ]
|
112
112
|
|
113
113
|
racc_action_default = [
|
114
|
-
-
|
115
|
-
-
|
116
|
-
-
|
117
|
-
-
|
118
|
-
-
|
119
|
-
-13, -
|
120
|
-
-
|
121
|
-
-
|
114
|
+
-26, -52, -52, -27, -28, -52, -52, -52, -26, -2,
|
115
|
+
-52, -7, -51, -29, -52, -52, 79, -1, -52, -17,
|
116
|
+
-24, -6, -52, -30, -32, -33, -34, -35, -52, -52,
|
117
|
+
-45, -46, -47, -48, -49, -50, -31, -3, -52, -52,
|
118
|
+
-22, -21, -52, -52, -4, -52, -8, -52, -11, -12,
|
119
|
+
-13, -36, -52, -39, -52, -41, -52, -44, -16, -14,
|
120
|
+
-52, -18, -19, -23, -25, -5, -9, -52, -37, -52,
|
121
|
+
-52, -42, -52, -15, -20, -10, -38, -40, -43 ]
|
122
122
|
|
123
123
|
racc_goto_table = [
|
124
|
-
24, 48, 49, 15, 9,
|
125
|
-
|
126
|
-
|
127
|
-
nil, nil, nil, nil,
|
128
|
-
|
129
|
-
54, nil, nil, nil, nil,
|
124
|
+
24, 48, 49, 53, 15, 9, 41, 1, 20, 54,
|
125
|
+
18, 40, 44, 2, 8, 57, 21, 47, 58, 13,
|
126
|
+
23, 17, 52, 56, nil, nil, 61, nil, nil, nil,
|
127
|
+
nil, nil, 62, nil, nil, nil, 20, 20, nil, 60,
|
128
|
+
nil, 64, nil, nil, 76, 63, 75, 49, 65, 74,
|
129
|
+
54, nil, nil, nil, nil, nil, 77, nil, 78 ]
|
130
130
|
|
131
131
|
racc_goto_check = [
|
132
|
-
12, 10, 11, 6, 4,
|
133
|
-
|
134
|
-
|
135
|
-
nil, nil, nil, nil,
|
136
|
-
6, nil, nil, 4,
|
137
|
-
23, nil, nil, nil, nil, 12, nil, 12 ]
|
132
|
+
12, 10, 11, 22, 6, 4, 14, 1, 6, 23,
|
133
|
+
5, 8, 8, 2, 3, 12, 7, 9, 13, 16,
|
134
|
+
17, 2, 21, 24, nil, nil, 14, nil, nil, nil,
|
135
|
+
nil, nil, 8, nil, nil, nil, 6, 6, nil, 5,
|
136
|
+
nil, 6, nil, nil, 22, 4, 10, 11, 4, 14,
|
137
|
+
23, nil, nil, nil, nil, nil, 12, nil, 12 ]
|
138
138
|
|
139
139
|
racc_goto_pointer = [
|
140
|
-
nil, 13,
|
141
|
-
-21, -20, -14, -
|
142
|
-
nil, -6, -
|
140
|
+
nil, 7, 13, 12, 3, 0, -2, 5, -9, -5,
|
141
|
+
-21, -20, -14, -20, -14, nil, 16, 6, nil, nil,
|
142
|
+
nil, -6, -25, -19, -6 ]
|
143
143
|
|
144
144
|
racc_goto_default = [
|
145
145
|
nil, nil, nil, nil, nil, nil, 11, nil, nil, nil,
|
@@ -166,42 +166,43 @@ racc_reduce_table = [
|
|
166
166
|
3, 26, :_reduce_16,
|
167
167
|
1, 26, :_reduce_17,
|
168
168
|
3, 34, :_reduce_18,
|
169
|
-
|
170
|
-
|
169
|
+
3, 34, :_reduce_19,
|
170
|
+
4, 34, :_reduce_20,
|
171
171
|
2, 34, :_reduce_21,
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
172
|
+
2, 34, :_reduce_22,
|
173
|
+
3, 34, :_reduce_23,
|
174
|
+
1, 34, :_reduce_24,
|
175
|
+
2, 35, :_reduce_25,
|
176
|
+
0, 23, :_reduce_26,
|
176
177
|
1, 23, :_reduce_none,
|
177
178
|
1, 36, :_reduce_none,
|
178
|
-
2, 36, :
|
179
|
-
3, 37, :
|
180
|
-
3, 32, :
|
179
|
+
2, 36, :_reduce_29,
|
180
|
+
3, 37, :_reduce_30,
|
181
|
+
3, 32, :_reduce_31,
|
181
182
|
1, 38, :_reduce_none,
|
182
183
|
1, 33, :_reduce_none,
|
183
184
|
1, 33, :_reduce_none,
|
184
185
|
1, 33, :_reduce_none,
|
185
|
-
2, 39, :
|
186
|
-
3, 39, :
|
187
|
-
3, 42, :
|
186
|
+
2, 39, :_reduce_36,
|
187
|
+
3, 39, :_reduce_37,
|
188
|
+
3, 42, :_reduce_38,
|
188
189
|
1, 42, :_reduce_none,
|
189
|
-
3, 43, :
|
190
|
-
2, 40, :
|
191
|
-
3, 40, :
|
192
|
-
3, 45, :
|
193
|
-
1, 45, :
|
190
|
+
3, 43, :_reduce_40,
|
191
|
+
2, 40, :_reduce_41,
|
192
|
+
3, 40, :_reduce_42,
|
193
|
+
3, 45, :_reduce_43,
|
194
|
+
1, 45, :_reduce_44,
|
194
195
|
1, 41, :_reduce_none,
|
195
|
-
1, 41, :_reduce_45,
|
196
196
|
1, 41, :_reduce_46,
|
197
197
|
1, 41, :_reduce_47,
|
198
198
|
1, 41, :_reduce_48,
|
199
|
+
1, 41, :_reduce_49,
|
199
200
|
1, 44, :_reduce_none,
|
200
|
-
1, 27, :
|
201
|
+
1, 27, :_reduce_51 ]
|
201
202
|
|
202
|
-
racc_reduce_n =
|
203
|
+
racc_reduce_n = 52
|
203
204
|
|
204
|
-
racc_shift_n =
|
205
|
+
racc_shift_n = 79
|
205
206
|
|
206
207
|
racc_token_table = {
|
207
208
|
false => 0,
|
@@ -418,178 +419,185 @@ module_eval(<<'.,.,', 'parser.racc', 45)
|
|
418
419
|
|
419
420
|
module_eval(<<'.,.,', 'parser.racc', 46)
|
420
421
|
def _reduce_19(val, _values, result)
|
421
|
-
result = Node.new(val[0], val[
|
422
|
+
result = Node.new(val[0], val[1], nil, val[2].presence)
|
422
423
|
result
|
423
424
|
end
|
424
425
|
.,.,
|
425
426
|
|
426
427
|
module_eval(<<'.,.,', 'parser.racc', 47)
|
427
428
|
def _reduce_20(val, _values, result)
|
428
|
-
result = Node.new(val[0], val[
|
429
|
+
result = Node.new(val[0], val[3], val[2], nil )
|
429
430
|
result
|
430
431
|
end
|
431
432
|
.,.,
|
432
433
|
|
433
434
|
module_eval(<<'.,.,', 'parser.racc', 48)
|
434
435
|
def _reduce_21(val, _values, result)
|
435
|
-
result = Node.new(val[0], nil, nil
|
436
|
+
result = Node.new(val[0], val[1], nil, nil )
|
436
437
|
result
|
437
438
|
end
|
438
439
|
.,.,
|
439
440
|
|
440
441
|
module_eval(<<'.,.,', 'parser.racc', 49)
|
441
442
|
def _reduce_22(val, _values, result)
|
442
|
-
result = Node.new(val[0], nil, val[
|
443
|
+
result = Node.new(val[0], nil, nil, val[1].presence)
|
443
444
|
result
|
444
445
|
end
|
445
446
|
.,.,
|
446
447
|
|
447
448
|
module_eval(<<'.,.,', 'parser.racc', 50)
|
448
449
|
def _reduce_23(val, _values, result)
|
449
|
-
result = Node.new(val[0], nil,
|
450
|
+
result = Node.new(val[0], nil, val[2], nil )
|
450
451
|
result
|
451
452
|
end
|
452
453
|
.,.,
|
453
454
|
|
454
|
-
module_eval(<<'.,.,', 'parser.racc',
|
455
|
+
module_eval(<<'.,.,', 'parser.racc', 51)
|
455
456
|
def _reduce_24(val, _values, result)
|
456
|
-
result = val[
|
457
|
+
result = Node.new(val[0], nil, nil, nil )
|
457
458
|
result
|
458
459
|
end
|
459
460
|
.,.,
|
460
461
|
|
461
|
-
module_eval(<<'.,.,', 'parser.racc',
|
462
|
+
module_eval(<<'.,.,', 'parser.racc', 55)
|
462
463
|
def _reduce_25(val, _values, result)
|
463
|
-
result =
|
464
|
+
result = val[1]
|
464
465
|
result
|
465
466
|
end
|
466
467
|
.,.,
|
467
468
|
|
468
|
-
|
469
|
+
module_eval(<<'.,.,', 'parser.racc', 59)
|
470
|
+
def _reduce_26(val, _values, result)
|
471
|
+
result = {}
|
472
|
+
result
|
473
|
+
end
|
474
|
+
.,.,
|
469
475
|
|
470
476
|
# reduce 27 omitted
|
471
477
|
|
472
|
-
|
473
|
-
|
478
|
+
# reduce 28 omitted
|
479
|
+
|
480
|
+
module_eval(<<'.,.,', 'parser.racc', 65)
|
481
|
+
def _reduce_29(val, _values, result)
|
474
482
|
result.update val[1]
|
475
483
|
result
|
476
484
|
end
|
477
485
|
.,.,
|
478
486
|
|
479
|
-
module_eval(<<'.,.,', 'parser.racc',
|
480
|
-
def
|
487
|
+
module_eval(<<'.,.,', 'parser.racc', 69)
|
488
|
+
def _reduce_30(val, _values, result)
|
481
489
|
result = { val[0] => val[2] }
|
482
490
|
result
|
483
491
|
end
|
484
492
|
.,.,
|
485
493
|
|
486
|
-
module_eval(<<'.,.,', 'parser.racc',
|
487
|
-
def
|
494
|
+
module_eval(<<'.,.,', 'parser.racc', 73)
|
495
|
+
def _reduce_31(val, _values, result)
|
488
496
|
result = val[1]
|
489
497
|
result
|
490
498
|
end
|
491
499
|
.,.,
|
492
500
|
|
493
|
-
# reduce 31 omitted
|
494
|
-
|
495
501
|
# reduce 32 omitted
|
496
502
|
|
497
503
|
# reduce 33 omitted
|
498
504
|
|
499
505
|
# reduce 34 omitted
|
500
506
|
|
501
|
-
|
502
|
-
|
507
|
+
# reduce 35 omitted
|
508
|
+
|
509
|
+
module_eval(<<'.,.,', 'parser.racc', 87)
|
510
|
+
def _reduce_36(val, _values, result)
|
503
511
|
result = {}
|
504
512
|
result
|
505
513
|
end
|
506
514
|
.,.,
|
507
515
|
|
508
|
-
module_eval(<<'.,.,', 'parser.racc',
|
509
|
-
def
|
516
|
+
module_eval(<<'.,.,', 'parser.racc', 88)
|
517
|
+
def _reduce_37(val, _values, result)
|
510
518
|
result = val[1]
|
511
519
|
result
|
512
520
|
end
|
513
521
|
.,.,
|
514
522
|
|
515
|
-
module_eval(<<'.,.,', 'parser.racc',
|
516
|
-
def
|
523
|
+
module_eval(<<'.,.,', 'parser.racc', 92)
|
524
|
+
def _reduce_38(val, _values, result)
|
517
525
|
result.update val[2]
|
518
526
|
result
|
519
527
|
end
|
520
528
|
.,.,
|
521
529
|
|
522
|
-
# reduce
|
530
|
+
# reduce 39 omitted
|
523
531
|
|
524
|
-
module_eval(<<'.,.,', 'parser.racc',
|
525
|
-
def
|
532
|
+
module_eval(<<'.,.,', 'parser.racc', 97)
|
533
|
+
def _reduce_40(val, _values, result)
|
526
534
|
result = { val[0] => val[2] }
|
527
535
|
result
|
528
536
|
end
|
529
537
|
.,.,
|
530
538
|
|
531
|
-
module_eval(<<'.,.,', 'parser.racc',
|
532
|
-
def
|
539
|
+
module_eval(<<'.,.,', 'parser.racc', 101)
|
540
|
+
def _reduce_41(val, _values, result)
|
533
541
|
result = []
|
534
542
|
result
|
535
543
|
end
|
536
544
|
.,.,
|
537
545
|
|
538
|
-
module_eval(<<'.,.,', 'parser.racc',
|
539
|
-
def
|
546
|
+
module_eval(<<'.,.,', 'parser.racc', 102)
|
547
|
+
def _reduce_42(val, _values, result)
|
540
548
|
result = val[1]
|
541
549
|
result
|
542
550
|
end
|
543
551
|
.,.,
|
544
552
|
|
545
|
-
module_eval(<<'.,.,', 'parser.racc',
|
546
|
-
def
|
553
|
+
module_eval(<<'.,.,', 'parser.racc', 106)
|
554
|
+
def _reduce_43(val, _values, result)
|
547
555
|
result.push val[2]
|
548
556
|
result
|
549
557
|
end
|
550
558
|
.,.,
|
551
559
|
|
552
|
-
module_eval(<<'.,.,', 'parser.racc',
|
553
|
-
def
|
560
|
+
module_eval(<<'.,.,', 'parser.racc', 107)
|
561
|
+
def _reduce_44(val, _values, result)
|
554
562
|
result = val
|
555
563
|
result
|
556
564
|
end
|
557
565
|
.,.,
|
558
566
|
|
559
|
-
# reduce
|
567
|
+
# reduce 45 omitted
|
560
568
|
|
561
|
-
module_eval(<<'.,.,', 'parser.racc',
|
562
|
-
def
|
569
|
+
module_eval(<<'.,.,', 'parser.racc', 112)
|
570
|
+
def _reduce_46(val, _values, result)
|
563
571
|
result = convert_number(val[0])
|
564
572
|
result
|
565
573
|
end
|
566
574
|
.,.,
|
567
575
|
|
568
|
-
module_eval(<<'.,.,', 'parser.racc',
|
569
|
-
def
|
576
|
+
module_eval(<<'.,.,', 'parser.racc', 113)
|
577
|
+
def _reduce_47(val, _values, result)
|
570
578
|
result = true
|
571
579
|
result
|
572
580
|
end
|
573
581
|
.,.,
|
574
582
|
|
575
|
-
module_eval(<<'.,.,', 'parser.racc',
|
576
|
-
def
|
583
|
+
module_eval(<<'.,.,', 'parser.racc', 114)
|
584
|
+
def _reduce_48(val, _values, result)
|
577
585
|
result = false
|
578
586
|
result
|
579
587
|
end
|
580
588
|
.,.,
|
581
589
|
|
582
|
-
module_eval(<<'.,.,', 'parser.racc',
|
583
|
-
def
|
590
|
+
module_eval(<<'.,.,', 'parser.racc', 115)
|
591
|
+
def _reduce_49(val, _values, result)
|
584
592
|
result = nil
|
585
593
|
result
|
586
594
|
end
|
587
595
|
.,.,
|
588
596
|
|
589
|
-
# reduce
|
597
|
+
# reduce 50 omitted
|
590
598
|
|
591
|
-
module_eval(<<'.,.,', 'parser.racc',
|
592
|
-
def
|
599
|
+
module_eval(<<'.,.,', 'parser.racc', 122)
|
600
|
+
def _reduce_51(val, _values, result)
|
593
601
|
result = val[0].to_sym
|
594
602
|
result
|
595
603
|
end
|
data/lib/gql/schema/call.rb
CHANGED
@@ -4,8 +4,7 @@ module GQL
|
|
4
4
|
cursor :id
|
5
5
|
|
6
6
|
string :id
|
7
|
-
|
8
|
-
object :result_class, -> { target.result_class || Placeholder }, node_class: Node
|
7
|
+
object :result_class, -> { target.result_class || Placeholder }, node_class: Root
|
9
8
|
array :parameters, -> { (target.proc || target.instance_method(:execute)).parameters }, item_class: Parameter
|
10
9
|
end
|
11
10
|
end
|
data/lib/gql/schema/field.rb
CHANGED
data/lib/gql/schema/list.rb
CHANGED
data/lib/gql/schema/parameter.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module GQL
|
2
2
|
module Schema
|
3
3
|
class Parameter < GQL::Node
|
4
|
-
|
4
|
+
TYPES = {
|
5
5
|
req: 'required',
|
6
6
|
opt: 'optional',
|
7
7
|
rest: 'rest',
|
@@ -14,7 +14,11 @@ module GQL
|
|
14
14
|
cursor -> { target[1].to_s }
|
15
15
|
|
16
16
|
string :id, -> { target[1].to_s }
|
17
|
-
string :
|
17
|
+
string :type, -> { TYPES[target[0]] || target[0].to_s }
|
18
|
+
|
19
|
+
def raw_value
|
20
|
+
"#{target[1]} (#{TYPES[target[0]] || target[0]})"
|
21
|
+
end
|
18
22
|
end
|
19
23
|
end
|
20
24
|
end
|
data/lib/gql/schema/root.rb
CHANGED
@@ -1,9 +1,14 @@
|
|
1
1
|
module GQL
|
2
2
|
module Schema
|
3
3
|
class Root < GQL::Node
|
4
|
-
string
|
4
|
+
string :name
|
5
|
+
|
5
6
|
connection :calls, -> { target.calls.values }, list_class: List, item_class: Call
|
6
7
|
connection :fields, -> { target.fields.values }, list_class: List, item_class: Field
|
8
|
+
|
9
|
+
def raw_value
|
10
|
+
target.name
|
11
|
+
end
|
7
12
|
end
|
8
13
|
end
|
9
14
|
end
|
data/lib/gql/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Andert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|