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

Commit ecf5b22

Browse files
committed
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 0388fb1 commit ecf5b22

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
@@ -57,15 +57,14 @@ local function avro_type(avro_schema)
5757
error('unrecognized avro-schema type: ' .. json.encode(avro_schema))
5858
end
5959

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

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

6766
assert(gql_class.ofType ~= nil, 'gql_class.ofType must not be nil')
68-
return gql_class.ofType
67+
return nullable(gql_class.ofType)
6968
end
7069

7170
local types_long = types.scalar({

0 commit comments

Comments
 (0)