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

Commit f0fb9f4

Browse files
committed
move nullable function to utils as it is will be
necessary for tests
1 parent 31897d6 commit f0fb9f4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

graphql/utils.lua

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,16 @@ function utils.gen_booking_table(data)
132132
})
133133
end
134134

135+
-- XXX: recursive skip several NonNull's?
136+
function utils.nullable(gql_class)
137+
assert(type(gql_class) == 'table', 'gql_class must be a table, got ' ..
138+
type(gql_class))
139+
140+
if gql_class.__type ~= 'NonNull' then return gql_class end
141+
142+
assert(gql_class.ofType ~= nil, 'gql_class.ofType must not be nil')
143+
return gql_class.ofType
144+
end
145+
146+
135147
return utils

0 commit comments

Comments
 (0)