Commit bc5228ae authored by Vitali Tatarintev's avatar Vitali Tatarintev

Raise an error when both `fields` and block passed

Raise an error when both `fields` and block passed to the
`graphql_mutation` helper.
parent 00bf6a60
......@@ -78,6 +78,8 @@ module GraphqlHelpers
end
def graphql_mutation(name, input, fields = nil, &block)
raise ArgumentError, 'Please pass either `fields` parameter or a block to `#graphql_mutation`, but not both.' if fields.present? && block_given?
mutation_name = GraphqlHelpers.fieldnamerize(name)
input_variable_name = "$#{input_variable_name_for_mutation(name)}"
mutation_field = GitlabSchema.mutation.fields[mutation_name]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment