Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Commit 218e08a

Browse files
committed
closes #8
1 parent b046ce8 commit 218e08a

27 files changed

+4524
-302
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ make test
9797

9898
* For use: tarantool, lulpeg, >=tarantool/shard-1.1-91-gfa88bf8 (optional),
9999
tarantool/avro-schema.
100-
* For test (additionally to 'for use'): python 2.7, virtualenv, luacheck.
100+
* For test (additionally to 'for use'): python 2.7, virtualenv, luacheck,
101+
>=tarantool/shard-1.1-92-gec1a27e.
101102
* For building apidoc (additionally to 'for use'): ldoc.
102103

103104
## License

graphql/accessor_general.lua

Lines changed: 341 additions & 111 deletions
Large diffs are not rendered by default.

graphql/core/execute.lua

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,16 @@ local function shouldIncludeNode(selection, context)
4747
end
4848

4949
local function doesFragmentApply(fragment, type, context)
50+
51+
--print('print from doesFragmentApply - 51')
52+
--print('fragment')
53+
--require('pl.pretty').dump(fragment)
54+
5055
if not fragment.typeCondition then return true end
5156

5257
local innerType = typeFromAST(fragment.typeCondition, context.schema)
58+
--print('innerType')
59+
--require('pl.pretty').dump(innerType)
5360

5461
if innerType == type then
5562
return true
@@ -156,6 +163,13 @@ local function completeValue(fieldType, result, subSelections, context)
156163
local completedResult = completeValue(innerType, result, subSelections, context)
157164

158165
if completedResult == nil then
166+
--@todo remove comments
167+
--print('print from completeValue')
168+
--print('result')
169+
--require('pl.pretty').dump(result)
170+
--print('fieldType')
171+
--require('pl.pretty').dump(fieldType)
172+
159173
error('No value provided for non-null ' .. (innerType.name or innerType.__type))
160174
end
161175

@@ -175,6 +189,15 @@ local function completeValue(fieldType, result, subSelections, context)
175189

176190
local values = {}
177191
for i, value in ipairs(result) do
192+
--@todo remove comments
193+
--print('print for ipairs(result) 195')
194+
--require('pl.pretty').dump(result)
195+
--print('value')
196+
--require('pl.pretty').dump(value)
197+
--print('subSelections')
198+
--require('pl.pretty').dump(subSelections)
199+
200+
178201
values[i] = completeValue(innerType, value, subSelections, context)
179202
end
180203

@@ -200,6 +223,11 @@ local function getFieldEntry(objectType, object, fields, context)
200223
local firstField = fields[1]
201224
local fieldName = firstField.name.value
202225
local responseKey = getFieldResponseKey(firstField)
226+
--print('print from getFieldEntry')
227+
--print('objectType')
228+
--require('pl.pretty').dump(objectType)
229+
--print('object itself')
230+
--require('pl.pretty').dump(object)
203231
local fieldType = introspection.fieldMap[fieldName] or objectType.fields[fieldName]
204232

205233
if fieldType == nil then
@@ -236,6 +264,16 @@ local function getFieldEntry(objectType, object, fields, context)
236264
end
237265

238266
evaluateSelections = function(objectType, object, selections, context)
267+
268+
--@todo remove debug
269+
--print('EVALUETE SELECTIONS')
270+
----print('objectType')
271+
----require('pl.pretty').dump(objectType)
272+
--print('object')
273+
--require('pl.pretty').dump(object)
274+
--
275+
--print('EVALUETE SELECTIONS CLOSE')
276+
239277
local groupedFieldSet = collectFields(objectType, selections, {}, {}, context)
240278

241279
return util.map(groupedFieldSet, function(fields)

graphql/core/types.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,14 @@ end
155155
function types.union(config)
156156
assert(type(config.name) == 'string', 'type name must be provided as a string')
157157
assert(type(config.types) == 'table', 'types table must be provided')
158+
assert(type(config.resolveType) == 'function', 'resolveType function must ' ..
159+
'be provided')
158160

159161
local instance = {
160162
__type = 'Union',
161163
name = config.name,
162-
types = config.types
164+
types = config.types,
165+
resolveType = config.resolveType
163166
}
164167

165168
instance.nonNull = types.nonNull(instance)

graphql/core/validate.lua

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,20 @@ local function getParentField(context, name, count)
1515
parent = parent.ofType
1616
end
1717

18+
if parent.fields == nil then
19+
print('print from getParentField - 18 - parent')
20+
print('trying to get ' .. name)
21+
require('pl.pretty').dump(parent)
22+
23+
-- --@todo find in what ... on where are
24+
end
25+
--
26+
27+
--if parent.fields == nil and parent.__type == 'Union' and parent.types ~= nil
28+
-- then
29+
--
30+
--end
31+
1832
return parent.fields[name]
1933
end
2034

0 commit comments

Comments
 (0)