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

Commit 8a070d2

Browse files
committed
Warn on object and list arguments clash
1 parent eac21e2 commit 8a070d2

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

graphql/convert_schema/schema.lua

+12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
--- Convert extended avro-schema (collections) to GraphQL schema.
22

3+
local log = require('log')
34
local core_types = require('graphql.core.types')
45
local core_schema = require('graphql.core.schema')
56
local gen_arguments = require('graphql.gen_arguments')
@@ -358,6 +359,17 @@ function schema.convert(state, cfg)
358359
local object_args = state.object_arguments[collection_name]
359360
local list_args = state.list_arguments[collection_name]
360361

362+
-- check for names clash
363+
for name, _ in pairs(list_args) do
364+
if object_args[name] ~= nil then
365+
local err = ('the argument "%s" generated from the same ' ..
366+
'named field of the collection "%s" is superseded with ' ..
367+
'the list filtering argument "%s"'):format(name,
368+
collection_name, name)
369+
log.warn(err)
370+
end
371+
end
372+
361373
local args = utils.merge_tables(object_args, list_args)
362374
state.all_arguments[collection_name] = args
363375
end

0 commit comments

Comments
 (0)