graphql-libgraphqlparser 0.5.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +1 -0
- data/README.md +11 -9
- data/ext/graphql_libgraphqlparser_ext/visitor_functions.c +97 -113
- data/graphql-libgraphqlparser.gemspec +1 -1
- data/lib/graphql/libgraphqlparser/builder.rb +1 -3
- data/lib/graphql/libgraphqlparser/version.rb +1 -1
- data/test/graphql/libgraphqlparser_test.rb +2 -2
- metadata +4 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5f809dc67b6cd33f071581cc7cb1afbf8f30ef4
|
4
|
+
data.tar.gz: d277a96dfbc145f057d82a6f7e87415d3f4c9b12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e57017016982b4268d335afea057394ee3373429f7c9d2ad601c67899c661ad3dc90d7d66b0eaccf575121c206b2570dda6dc2dac25159dc1c2e1560eb43205c
|
7
|
+
data.tar.gz: 3ad7dd6c81802dc3b711f456282ed72a9ea1cb4f65bd2fddaeb61bf6514eca075d35566d333da6876926363a30d1e35a8b9a9cacc36466691125a8a44edf6fb5
|
data/.yardopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--markup=markdown
|
data/README.md
CHANGED
@@ -5,18 +5,20 @@ Make [`graphql`](https://github.com/rmosolgo/graphql-ruby) faster with [`libgrap
|
|
5
5
|
It's faster:
|
6
6
|
|
7
7
|
```
|
8
|
-
~/projects/graphql-libgraphqlparser $
|
8
|
+
~/projects/graphql-libgraphqlparser $ bundle exec ruby benchmark.rb
|
9
9
|
user system total real
|
10
|
-
Ruby
|
11
|
-
C 0.
|
12
|
-
~/projects/graphql-libgraphqlparser $
|
10
|
+
Ruby 0.090000 0.000000 0.090000 ( 0.088713)
|
11
|
+
C 0.010000 0.000000 0.010000 ( 0.012827)
|
12
|
+
~/projects/graphql-libgraphqlparser $ bundle exec ruby benchmark.rb
|
13
13
|
user system total real
|
14
|
-
Ruby
|
15
|
-
C 0.
|
16
|
-
~/projects/graphql-libgraphqlparser $
|
14
|
+
Ruby 0.090000 0.010000 0.100000 ( 0.090548)
|
15
|
+
C 0.010000 0.000000 0.010000 ( 0.013126)
|
16
|
+
~/projects/graphql-libgraphqlparser $ bundle exec ruby benchmark.rb
|
17
17
|
user system total real
|
18
|
-
Ruby
|
19
|
-
C 0.
|
18
|
+
Ruby 0.080000 0.000000 0.080000 ( 0.090066)
|
19
|
+
C 0.020000 0.000000 0.020000 ( 0.011790)
|
20
|
+
~/projects/graphql-libgraphqlparser $ bundle show graphql
|
21
|
+
~/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/graphql-0.19.4
|
20
22
|
```
|
21
23
|
|
22
24
|
## Installation
|
@@ -1,60 +1,20 @@
|
|
1
1
|
#include "graphql_libgraphqlparser_ext.h"
|
2
2
|
|
3
|
-
//
|
4
|
-
//
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
rb_str_new2(node_name_string) \
|
14
|
-
); \
|
15
|
-
set_node_location((struct GraphQLAstNode *)node, rb_node);
|
16
|
-
|
17
|
-
#define END \
|
18
|
-
rb_funcall( \
|
19
|
-
(VALUE) builder_ptr, \
|
20
|
-
end_visit_intern, \
|
21
|
-
0 \
|
22
|
-
); \
|
23
|
-
|
24
|
-
#define ADD_LITERAL(rb_value) \
|
25
|
-
rb_funcall( \
|
26
|
-
(VALUE) builder_ptr, \
|
27
|
-
add_value_intern, \
|
28
|
-
1, \
|
29
|
-
rb_value \
|
30
|
-
); \
|
31
|
-
|
32
|
-
|
33
|
-
#define ASSIGN_NAME(get_name_fn) \
|
34
|
-
rb_funcall(rb_node, name_set_intern, 1, \
|
35
|
-
rb_str_new2( \
|
36
|
-
GraphQLAstName_get_value( \
|
37
|
-
get_name_fn(node) \
|
38
|
-
) \
|
39
|
-
) \
|
40
|
-
); \
|
41
|
-
|
42
|
-
#define ASSIGN_NAMED_TYPE(type) \
|
43
|
-
rb_funcall( \
|
44
|
-
rb_node, \
|
45
|
-
type_set_intern, \
|
46
|
-
1, \
|
47
|
-
rb_str_new2( \
|
48
|
-
GraphQLAstName_get_value( \
|
49
|
-
GraphQLAstNamedType_get_name( \
|
50
|
-
type \
|
51
|
-
) \
|
52
|
-
) \
|
53
|
-
) \
|
54
|
-
); \
|
3
|
+
// Get the name from `node` using `get_name_fn`,
|
4
|
+
// then assign it to `rb_node` with `#name=`
|
5
|
+
#define ASSIGN_NAME(rb_node, node, get_name_fn) \
|
6
|
+
rb_funcall(rb_node, name_set_intern, 1, \
|
7
|
+
rb_str_new2( \
|
8
|
+
GraphQLAstName_get_value( \
|
9
|
+
get_name_fn(node) \
|
10
|
+
) \
|
11
|
+
) \
|
12
|
+
); \
|
55
13
|
|
56
14
|
VALUE type_set_intern, name_set_intern, add_value_intern, end_visit_intern, begin_visit_intern, line_set_intern, col_set_intern;
|
15
|
+
int rb_utf_8_enc;
|
57
16
|
|
17
|
+
// Get the line & column from `node` and assign it to `rb_node`
|
58
18
|
inline void set_node_location(const struct GraphQLAstNode *node, VALUE rb_node) {
|
59
19
|
struct GraphQLAstLocation location = {0};
|
60
20
|
graphql_node_get_location(node, &location);
|
@@ -62,6 +22,38 @@ inline void set_node_location(const struct GraphQLAstNode *node, VALUE rb_node)
|
|
62
22
|
rb_funcall(rb_node, col_set_intern, 1, INT2NUM(location.beginColumn));
|
63
23
|
}
|
64
24
|
|
25
|
+
// Call the finalizer method on `builder_ptr`
|
26
|
+
inline void end_visit(void * builder_ptr) {
|
27
|
+
rb_funcall(
|
28
|
+
(VALUE) builder_ptr,
|
29
|
+
end_visit_intern,
|
30
|
+
0
|
31
|
+
);
|
32
|
+
}
|
33
|
+
|
34
|
+
// Build a Ruby node named `node_name_string` out of `node` and return it
|
35
|
+
inline VALUE build_rb_node(struct GraphQLAstNode* node, char* node_name_string, void* builder_ptr) {
|
36
|
+
VALUE rb_node = rb_funcall(
|
37
|
+
(VALUE) builder_ptr,
|
38
|
+
begin_visit_intern,
|
39
|
+
1,
|
40
|
+
rb_str_new2(node_name_string)
|
41
|
+
);
|
42
|
+
set_node_location(node, rb_node);
|
43
|
+
return rb_node;
|
44
|
+
}
|
45
|
+
|
46
|
+
// Send `rb_literal_value` to the current node's `#value=` method
|
47
|
+
inline void assign_literal_value(VALUE rb_literal_value, void* builder_ptr) {
|
48
|
+
rb_funcall(
|
49
|
+
(VALUE) builder_ptr,
|
50
|
+
add_value_intern,
|
51
|
+
1,
|
52
|
+
rb_literal_value
|
53
|
+
);
|
54
|
+
}
|
55
|
+
|
56
|
+
// Prepare a bunch of global Ruby method IDs
|
65
57
|
void init_visitor_functions() {
|
66
58
|
type_set_intern = rb_intern("type=");
|
67
59
|
name_set_intern = rb_intern("name=");
|
@@ -70,6 +62,7 @@ void init_visitor_functions() {
|
|
70
62
|
begin_visit_intern = rb_intern("begin_visit");
|
71
63
|
line_set_intern = rb_intern("line=");
|
72
64
|
col_set_intern = rb_intern("col=");
|
65
|
+
rb_utf_8_enc = rb_enc_find_index("UTF-8");
|
73
66
|
}
|
74
67
|
|
75
68
|
// There's a `begin_visit` and `end_visit` for each node.
|
@@ -77,7 +70,7 @@ void init_visitor_functions() {
|
|
77
70
|
// It lets us use macros in the other files.
|
78
71
|
|
79
72
|
int document_begin_visit(const struct GraphQLAstDocument* node, void* builder_ptr) {
|
80
|
-
|
73
|
+
build_rb_node((struct GraphQLAstNode*) node, "Document", builder_ptr);
|
81
74
|
return 1;
|
82
75
|
}
|
83
76
|
|
@@ -87,9 +80,9 @@ void document_end_visit(const struct GraphQLAstDocument* node, void* builder_ptr
|
|
87
80
|
int operation_definition_begin_visit(const struct GraphQLAstOperationDefinition* node, void* builder_ptr) {
|
88
81
|
const struct GraphQLAstName* ast_operation_name;
|
89
82
|
const char* operation_type;
|
90
|
-
VALUE operation_type_str;
|
83
|
+
VALUE operation_type_str, rb_node;
|
91
84
|
|
92
|
-
|
85
|
+
rb_node = build_rb_node((struct GraphQLAstNode*) node, "OperationDefinition", builder_ptr);
|
93
86
|
|
94
87
|
ast_operation_name = GraphQLAstOperationDefinition_get_name(node);
|
95
88
|
if (ast_operation_name) {
|
@@ -111,48 +104,47 @@ int operation_definition_begin_visit(const struct GraphQLAstOperationDefinition*
|
|
111
104
|
}
|
112
105
|
|
113
106
|
void operation_definition_end_visit(const struct GraphQLAstOperationDefinition* node, void* builder_ptr) {
|
114
|
-
|
107
|
+
end_visit(builder_ptr);
|
115
108
|
}
|
116
109
|
|
117
110
|
int variable_definition_begin_visit(const struct GraphQLAstVariableDefinition* node, void* builder_ptr) {
|
118
|
-
|
111
|
+
build_rb_node((struct GraphQLAstNode*) node, "VariableDefinition", builder_ptr);
|
119
112
|
return 1;
|
120
113
|
}
|
121
114
|
|
122
115
|
void variable_definition_end_visit(const struct GraphQLAstVariableDefinition* node, void* builder_ptr) {
|
123
|
-
|
116
|
+
end_visit(builder_ptr);
|
124
117
|
}
|
125
118
|
|
126
119
|
|
127
120
|
int fragment_definition_begin_visit(const struct GraphQLAstFragmentDefinition* node, void* builder_ptr) {
|
128
|
-
|
129
|
-
ASSIGN_NAME(GraphQLAstFragmentDefinition_get_name)
|
130
|
-
const struct GraphQLAstNamedType *type = GraphQLAstFragmentDefinition_get_type_condition(node);
|
131
|
-
ASSIGN_NAMED_TYPE(type)
|
121
|
+
VALUE rb_node = build_rb_node((struct GraphQLAstNode*) node, "FragmentDefinition", builder_ptr);
|
122
|
+
ASSIGN_NAME(rb_node, node, GraphQLAstFragmentDefinition_get_name)
|
132
123
|
return 1;
|
133
124
|
}
|
134
125
|
|
135
126
|
void fragment_definition_end_visit(const struct GraphQLAstFragmentDefinition* node, void* builder_ptr) {
|
136
|
-
|
127
|
+
end_visit(builder_ptr);
|
137
128
|
}
|
138
129
|
|
139
130
|
|
140
131
|
int variable_begin_visit(const struct GraphQLAstVariable* node, void* builder_ptr) {
|
141
|
-
|
132
|
+
VALUE rb_node = build_rb_node((struct GraphQLAstNode*) node, "VariableIdentifier", builder_ptr);
|
142
133
|
// This might actually assign the name of a VariableDefinition:
|
143
|
-
ASSIGN_NAME(GraphQLAstVariable_get_name)
|
134
|
+
ASSIGN_NAME(rb_node, node, GraphQLAstVariable_get_name)
|
144
135
|
return 1;
|
145
136
|
}
|
146
137
|
|
147
138
|
void variable_end_visit(const struct GraphQLAstVariable* node, void* builder_ptr) {
|
148
|
-
|
139
|
+
end_visit(builder_ptr);
|
149
140
|
}
|
150
141
|
|
151
142
|
int field_begin_visit(const struct GraphQLAstField* node, void* builder_ptr) {
|
152
143
|
const struct GraphQLAstName* ast_field_alias;
|
153
144
|
const char* str_field_alias;
|
154
|
-
|
155
|
-
|
145
|
+
VALUE rb_node = build_rb_node((struct GraphQLAstNode*) node, "Field", builder_ptr);
|
146
|
+
|
147
|
+
ASSIGN_NAME(rb_node, node, GraphQLAstField_get_name)
|
156
148
|
|
157
149
|
ast_field_alias = GraphQLAstField_get_alias(node);
|
158
150
|
if (ast_field_alias) {
|
@@ -163,87 +155,83 @@ int field_begin_visit(const struct GraphQLAstField* node, void* builder_ptr) {
|
|
163
155
|
}
|
164
156
|
|
165
157
|
void field_end_visit(const struct GraphQLAstField* node, void* builder_ptr) {
|
166
|
-
|
158
|
+
end_visit(builder_ptr);
|
167
159
|
}
|
168
160
|
|
169
161
|
int directive_begin_visit(const struct GraphQLAstDirective* node, void* builder_ptr) {
|
170
|
-
|
171
|
-
|
162
|
+
VALUE rb_node = build_rb_node((struct GraphQLAstNode*) node, "Directive", builder_ptr);
|
163
|
+
|
164
|
+
ASSIGN_NAME(rb_node, node, GraphQLAstDirective_get_name)
|
172
165
|
return 1;
|
173
166
|
}
|
174
167
|
|
175
168
|
void directive_end_visit(const struct GraphQLAstDirective* node, void* builder_ptr) {
|
176
|
-
|
169
|
+
end_visit(builder_ptr);
|
177
170
|
}
|
178
171
|
|
179
172
|
int argument_begin_visit(const struct GraphQLAstArgument* node, void* builder_ptr) {
|
180
|
-
|
181
|
-
ASSIGN_NAME(GraphQLAstArgument_get_name)
|
173
|
+
VALUE rb_node = build_rb_node((struct GraphQLAstNode*) node, "Argument", builder_ptr);
|
174
|
+
ASSIGN_NAME(rb_node, node, GraphQLAstArgument_get_name)
|
182
175
|
return 1;
|
183
176
|
}
|
184
177
|
|
185
178
|
void argument_end_visit(const struct GraphQLAstArgument* node, void* builder_ptr) {
|
186
|
-
|
179
|
+
end_visit(builder_ptr);
|
187
180
|
}
|
188
181
|
|
189
182
|
int fragment_spread_begin_visit(const struct GraphQLAstFragmentSpread* node, void* builder_ptr) {
|
190
|
-
|
191
|
-
ASSIGN_NAME(GraphQLAstFragmentSpread_get_name)
|
183
|
+
VALUE rb_node = build_rb_node((struct GraphQLAstNode*) node, "FragmentSpread", builder_ptr);
|
184
|
+
ASSIGN_NAME(rb_node, node, GraphQLAstFragmentSpread_get_name)
|
192
185
|
return 1;
|
193
186
|
}
|
194
187
|
|
195
188
|
void fragment_spread_end_visit(const struct GraphQLAstFragmentSpread* node, void* builder_ptr) {
|
196
|
-
|
189
|
+
end_visit(builder_ptr);
|
197
190
|
}
|
198
191
|
|
199
192
|
int inline_fragment_begin_visit(const struct GraphQLAstInlineFragment* node, void* builder_ptr) {
|
200
|
-
|
201
|
-
const struct GraphQLAstNamedType *type = GraphQLAstInlineFragment_get_type_condition(node);
|
202
|
-
if (type) {
|
203
|
-
ASSIGN_NAMED_TYPE(type)
|
204
|
-
}
|
205
|
-
|
193
|
+
build_rb_node((struct GraphQLAstNode*) node, "InlineFragment", builder_ptr);
|
206
194
|
return 1;
|
207
195
|
}
|
208
196
|
|
209
197
|
void inline_fragment_end_visit(const struct GraphQLAstInlineFragment* node, void* builder_ptr) {
|
210
|
-
|
198
|
+
end_visit(builder_ptr);
|
211
199
|
}
|
212
200
|
|
213
201
|
int list_type_begin_visit(const struct GraphQLAstListType* node, void* builder_ptr) {
|
214
|
-
|
202
|
+
build_rb_node((struct GraphQLAstNode*) node, "ListType", builder_ptr);
|
215
203
|
return 1;
|
216
204
|
}
|
217
205
|
|
218
206
|
void list_type_end_visit(const struct GraphQLAstListType* node, void* builder_ptr) {
|
219
|
-
|
207
|
+
end_visit(builder_ptr);
|
220
208
|
}
|
221
209
|
|
222
210
|
|
223
211
|
int non_null_type_begin_visit(const struct GraphQLAstNonNullType* node, void* builder_ptr) {
|
224
|
-
|
212
|
+
build_rb_node((struct GraphQLAstNode*) node, "NonNullType", builder_ptr);
|
225
213
|
return 1;
|
226
214
|
}
|
227
215
|
|
228
216
|
void non_null_type_end_visit(const struct GraphQLAstNonNullType* node, void* builder_ptr) {
|
229
|
-
|
217
|
+
end_visit(builder_ptr);
|
230
218
|
}
|
231
219
|
|
232
220
|
int named_type_begin_visit(const struct GraphQLAstNamedType* node, void* builder_ptr) {
|
233
|
-
|
234
|
-
ASSIGN_NAME(GraphQLAstNamedType_get_name)
|
221
|
+
VALUE rb_node = build_rb_node((struct GraphQLAstNode*) node, "TypeName", builder_ptr);
|
222
|
+
ASSIGN_NAME(rb_node, node, GraphQLAstNamedType_get_name)
|
235
223
|
return 1;
|
236
224
|
}
|
237
225
|
|
238
226
|
void named_type_end_visit(const struct GraphQLAstNamedType* node, void* builder_ptr) {
|
239
|
-
|
227
|
+
end_visit(builder_ptr);
|
240
228
|
}
|
241
229
|
|
242
230
|
|
243
231
|
int float_value_begin_visit(const struct GraphQLAstFloatValue* node, void* builder_ptr) {
|
244
232
|
const char* str_float = GraphQLAstFloatValue_get_value(node);
|
245
233
|
VALUE rb_float = rb_funcall(rb_str_new2(str_float), rb_intern("to_f"), 0);
|
246
|
-
|
234
|
+
assign_literal_value(rb_float, builder_ptr);
|
247
235
|
return 1;
|
248
236
|
}
|
249
237
|
|
@@ -253,7 +241,7 @@ void float_value_end_visit(const struct GraphQLAstFloatValue* node, void* builde
|
|
253
241
|
int int_value_begin_visit(const struct GraphQLAstIntValue* node, void* builder_ptr) {
|
254
242
|
const char* str_int = GraphQLAstIntValue_get_value(node);
|
255
243
|
VALUE rb_int = rb_funcall(rb_str_new2(str_int), rb_intern("to_i"), 0);
|
256
|
-
|
244
|
+
assign_literal_value(rb_int, builder_ptr);
|
257
245
|
return 1;
|
258
246
|
}
|
259
247
|
|
@@ -262,11 +250,9 @@ void int_value_end_visit(const struct GraphQLAstIntValue* node, void* builder_pt
|
|
262
250
|
|
263
251
|
int boolean_value_begin_visit(const struct GraphQLAstBooleanValue* node, void* builder_ptr) {
|
264
252
|
const int bool_value = GraphQLAstBooleanValue_get_value(node);
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
ADD_LITERAL(Qfalse)
|
269
|
-
}
|
253
|
+
VALUE rb_bool = bool_value ? Qtrue : Qfalse;
|
254
|
+
assign_literal_value(rb_bool, builder_ptr);
|
255
|
+
|
270
256
|
return 1;
|
271
257
|
}
|
272
258
|
|
@@ -276,9 +262,8 @@ void boolean_value_end_visit(const struct GraphQLAstBooleanValue* node, void* bu
|
|
276
262
|
int string_value_begin_visit(const struct GraphQLAstStringValue* node, void* builder_ptr) {
|
277
263
|
const char* str_value = GraphQLAstStringValue_get_value(node);
|
278
264
|
VALUE rb_string = rb_str_new2(str_value);
|
279
|
-
|
280
|
-
|
281
|
-
ADD_LITERAL(rb_string);
|
265
|
+
rb_enc_associate_index(rb_string, rb_utf_8_enc);
|
266
|
+
assign_literal_value(rb_string, builder_ptr);
|
282
267
|
return 1;
|
283
268
|
}
|
284
269
|
|
@@ -288,43 +273,42 @@ void string_value_end_visit(const struct GraphQLAstStringValue* node, void* buil
|
|
288
273
|
int enum_value_begin_visit(const struct GraphQLAstEnumValue* node, void* builder_ptr) {
|
289
274
|
const char* str_value;
|
290
275
|
VALUE rb_string;
|
291
|
-
|
292
|
-
BEGIN("Enum");
|
276
|
+
VALUE rb_node = build_rb_node((struct GraphQLAstNode*) node, "Enum", builder_ptr);
|
293
277
|
str_value = GraphQLAstEnumValue_get_value(node);
|
294
278
|
rb_string = rb_str_new2(str_value);
|
295
|
-
rb_enc_associate_index(rb_string,
|
279
|
+
rb_enc_associate_index(rb_string, rb_utf_8_enc);
|
296
280
|
rb_funcall(rb_node, name_set_intern, 1, rb_string);
|
297
281
|
return 1;
|
298
282
|
}
|
299
283
|
|
300
284
|
void enum_value_end_visit(const struct GraphQLAstEnumValue* node, void* builder_ptr) {
|
301
|
-
|
285
|
+
end_visit(builder_ptr);
|
302
286
|
}
|
303
287
|
|
304
288
|
int list_value_begin_visit(const struct GraphQLAstListValue* node, void* builder_ptr) {
|
305
|
-
|
289
|
+
VALUE rb_node = build_rb_node((struct GraphQLAstNode*) node, "ListLiteral", builder_ptr);
|
306
290
|
return 1;
|
307
291
|
}
|
308
292
|
|
309
293
|
void list_value_end_visit(const struct GraphQLAstListValue* node, void* builder_ptr) {
|
310
|
-
|
294
|
+
end_visit(builder_ptr);
|
311
295
|
}
|
312
296
|
|
313
297
|
int object_value_begin_visit(const struct GraphQLAstObjectValue* node, void* builder_ptr) {
|
314
|
-
|
298
|
+
VALUE rb_node = build_rb_node((struct GraphQLAstNode*) node, "InputObject", builder_ptr);
|
315
299
|
return 1;
|
316
300
|
}
|
317
301
|
|
318
302
|
void object_value_end_visit(const struct GraphQLAstObjectValue* node, void* builder_ptr) {
|
319
|
-
|
303
|
+
end_visit(builder_ptr);
|
320
304
|
}
|
321
305
|
|
322
306
|
int object_field_begin_visit(const struct GraphQLAstObjectField* node, void* builder_ptr) {
|
323
|
-
|
324
|
-
ASSIGN_NAME(GraphQLAstObjectField_get_name)
|
307
|
+
VALUE rb_node = build_rb_node((struct GraphQLAstNode*) node, "Argument", builder_ptr);
|
308
|
+
ASSIGN_NAME(rb_node, node, GraphQLAstObjectField_get_name)
|
325
309
|
return 1;
|
326
310
|
}
|
327
311
|
|
328
312
|
void object_field_end_visit(const struct GraphQLAstObjectField* node, void* builder_ptr) {
|
329
|
-
|
313
|
+
end_visit(builder_ptr);
|
330
314
|
}
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
18
|
spec.require_paths = ['lib']
|
19
19
|
|
20
|
-
spec.add_runtime_dependency 'graphql', '~>
|
20
|
+
spec.add_runtime_dependency 'graphql', '~> 1.0'
|
21
21
|
|
22
22
|
spec.add_development_dependency 'bundler', '~> 1.0'
|
23
23
|
spec.add_development_dependency "guard", "~> 2.12"
|
@@ -40,9 +40,7 @@ module GraphQL
|
|
40
40
|
when Nodes::InlineFragment, Nodes::FragmentSpread, Nodes::Field
|
41
41
|
current.selections << node
|
42
42
|
when Nodes::TypeName, Nodes::ListType, Nodes::NonNullType
|
43
|
-
|
44
|
-
# this as a plain string :(
|
45
|
-
current.type ||= node
|
43
|
+
current.type = node
|
46
44
|
when Nodes::ListLiteral
|
47
45
|
# mutability! 🎉
|
48
46
|
current.value = node.values
|
@@ -51,7 +51,7 @@ describe GraphQL::Libgraphqlparser do
|
|
51
51
|
assert fragment_def.is_a?(GraphQL::Language::Nodes::FragmentDefinition)
|
52
52
|
assert_equal "moreNestedFields", fragment_def.name
|
53
53
|
assert_equal 1, fragment_def.selections.length
|
54
|
-
assert_equal "NestedType", fragment_def.type
|
54
|
+
assert_equal "NestedType", fragment_def.type.name
|
55
55
|
assert_equal 1, fragment_def.directives.length
|
56
56
|
assert_equal [17, 5], fragment_def.position
|
57
57
|
end
|
@@ -140,7 +140,7 @@ describe GraphQL::Libgraphqlparser do
|
|
140
140
|
describe "inline fragments" do
|
141
141
|
let(:inline_fragment) { query.selections[2] }
|
142
142
|
it "gets the type and directives" do
|
143
|
-
assert_equal "OtherType", inline_fragment.type
|
143
|
+
assert_equal "OtherType", inline_fragment.type.name
|
144
144
|
assert_equal 2, inline_fragment.selections.length
|
145
145
|
assert_equal 1, inline_fragment.directives.length
|
146
146
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql-libgraphqlparser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Mosolgo
|
@@ -16,20 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0
|
20
|
-
- - "<"
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 1.0.0
|
19
|
+
version: '1.0'
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
24
|
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '0
|
30
|
-
- - "<"
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 1.0.0
|
26
|
+
version: '1.0'
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: bundler
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -180,6 +174,7 @@ extra_rdoc_files: []
|
|
180
174
|
files:
|
181
175
|
- ".gitignore"
|
182
176
|
- ".travis.yml"
|
177
|
+
- ".yardopts"
|
183
178
|
- CHANGELOG.md
|
184
179
|
- Gemfile
|
185
180
|
- Guardfile
|