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

Commit 9a43096

Browse files
committed
simplify conditional statements
1 parent 24ec6c4 commit 9a43096

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

graphql/tarantool_graphql.lua

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ local function convert_record_fields_to_args(state, fields, opts)
199199

200200
---@todo consider case when gql_class is wrapper nonNull around List
201201
--- or Map
202-
if not(is_for_args and (gql_class == 'List' or gql_class == 'Map')) then
202+
if (not is_for_args) or (gql_class ~= 'List' and gql_class ~= 'Map') then
203203
args[field.name] = nullable(gql_class)
204204
end
205205
end
@@ -235,8 +235,8 @@ local function convert_record_fields(state, fields, opts)
235235

236236
---@todo consider case when gql_class is wrapper nonNull around List
237237
--- or Map
238-
if not (is_for_args and (res[field.name].kind == 'List'
239-
or res[field.name].kind == 'Map')) then
238+
if (not is_for_args) or (res[field.name].kind ~= 'List'
239+
and res[field.name].kind ~= 'Map') then
240240
object_args[field.name] = nullable(res[field.name].kind)
241241
end
242242
end
@@ -257,6 +257,9 @@ end
257257
--- automatically generate corresponding decucible fields.
258258
--- 2. The collection name will be used as the resulting graphql type name
259259
--- instead of the avro-schema name.
260+
---
261+
--- Resulting object will look like this:
262+
---
260263
gql_type = function(state, avro_schema, collection, collection_name)
261264
assert(type(state) == 'table',
262265
'state must be a table, got ' .. type(state))
@@ -450,6 +453,7 @@ local function parse_cfg(cfg)
450453

451454
local fields = {}
452455

456+
-- create fields (from collections) for top-level gql type 'query)
453457
for collection_name, collection in pairs(state.collections) do
454458
collection.name = collection_name
455459
assert(collection.schema_name ~= nil,

0 commit comments

Comments
 (0)