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

Commit 3c9d651

Browse files
committed
style fixes during review 2
1 parent 46f02b1 commit 3c9d651

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

graphql/core/rules.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,8 @@ function rules.fragmentSpreadIsPossible(node, context)
324324

325325
local valid = util.find(parentTypes, function(kind)
326326
local kind = kind
327+
-- Graphql-lua does not this check correctly in the case of NonNull
328+
-- wrapped fragment types. Next line fixes that
327329
if kind.__type == 'NonNull' then kind = kind.ofType end
328330
return fragmentTypes[kind]
329331
end)

graphql/tarantool_graphql.lua

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,26 @@
66
--- * GraphQL top level statement must be a collection name. Arguments for this
77
--- statement match non-deducible field names of corresponding object and
88
--- passed to an accessor function in the filter argument.
9+
---
10+
--- Border cases:
11+
---
12+
--- * Unions: as GraphQL specification says "...no fields may be queried on
13+
--- Union type without the use of typed fragments." Tarantool_graphql
14+
--- behaves this way. So 'common fields' are not supported. This does NOT work:
15+
---
16+
--- hero {
17+
-- hero_id -- common field
18+
-- ... on human {
19+
-- name
20+
-- }
21+
-- ... on droid {
22+
-- model
23+
-- }
24+
-- }
25+
--- (GraphQL spec: http://facebook.github.io/graphql/October2016/#sec-Unions)
26+
--- Also, no arguments are currently allowed for fragments.
27+
--- See issue about this (https://github.com/facebook/graphql/issues/204)
28+
---
929

1030
local json = require('json')
1131
local yaml = require('yaml')
@@ -359,7 +379,7 @@ local convert_simple_connection = function(state, connection, collection_name)
359379
'connection.destination_collection must be a string, got ' ..
360380
type(c.destination_collection))
361381
assert(type(c.parts) == 'table',
362-
'connection.parts must be a string, got ' .. type(c.parts))
382+
'connection.parts must be a table, got ' .. type(c.parts))
363383

364384
-- gql type of connection field
365385
local destination_type =
@@ -549,7 +569,7 @@ local convert_union_connection = function(state, connection, collection_name)
549569
('only 1:1* or 1:N connections can have ' ..
550570
'all key parts null; parent is %s from ' ..
551571
'collection "%s"'):format(json.encode(parent),
552-
tostring(collection_name)))
572+
tostring(collection_name)))
553573
end
554574
return c.type == '1:N' and {} or nil
555575
end

0 commit comments

Comments
 (0)