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

Commit cd5146d

Browse files
TotktonadaSudoBobo
authored andcommitted
tarantool_graphql::nullable for nesting NonNulls
It is for make the function general and don't have fears of corner cases. It will loop in case of x = { ofType = x }, but it is anyway incorrect input.
1 parent e04aef6 commit cd5146d

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

graphql/tarantool_graphql.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,14 @@ local function avro_type(avro_schema)
5858
error('unrecognized avro-schema type: ' .. json.encode(avro_schema))
5959
end
6060

61-
-- XXX: recursive skip several NonNull's?
6261
local function nullable(gql_class)
6362
assert(type(gql_class) == 'table', 'gql_class must be a table, got ' ..
6463
type(gql_class))
6564

6665
if gql_class.__type ~= 'NonNull' then return gql_class end
6766

6867
assert(gql_class.ofType ~= nil, 'gql_class.ofType must not be nil')
69-
return gql_class.ofType
68+
return nullable(gql_class.ofType)
7069
end
7170

7271
local types_long = types.scalar({

0 commit comments

Comments
 (0)