129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
# File 'lib/graphql/schema/validator/required_validator.rb', line 129
def build_message(context)
argument_definitions = context.types.arguments(@validated)
required_names = @one_of.map do |arg_keyword|
if arg_keyword.is_a?(Array)
names = arg_keyword.map { |arg| arg_keyword_to_graphql_name(argument_definitions, arg) }
names.compact!
"(" + names.join(" and ") + ")"
else
arg_keyword_to_graphql_name(argument_definitions, arg_keyword)
end
end
required_names.compact!
case required_names.size
when 0
"%{validated} is missing a required argument."
when 1
"%{validated} must include the following argument: #{required_names.first}."
else
"%{validated} must include exactly one of the following arguments: #{required_names.join(", ")}."
end
end
|