I have a resolver that takes a list of enums as an argument, but when i send something other than that enum ir raises an exception instead of returning an error. e.g:
enum:
class Enums::FooEnum < Enums::BaseObject
value 'Foo1', value: 'foo1'
value 'Foo2', value: 'foo2'
end
resolver:
class Resolvers::BarResolver < Resolvers::Base
argument :foo, [Enums::FooEnum], required: true
def resolve(**args)
# do something that raises `CantDoThatException`
# unless every element of `foo` is a `FooEnum`
end
end
query_1:
bar(foo: [Foo1, Foo2]) {
fields
}
query_2:
bar(foo: [Foo1, 'random_value']) {
fields
}
query_1 works as expected
query_2 raises CantDoThatException instead of returning something like:
{
"errors": [
{
"message": "Argument 'dimensions' on Field 'images' has an invalid value. Expected type '[FooEnum!]!'.", ...
...
}
]
}
Edit: After futher investigation i noticed that
>> args[:foo]
['foo1', nil]
So instead of returning an error it is casting all invalidad arguments to nil
Thanks for the great bug report! It will be fixed in the next release by #2441
Most helpful comment
Thanks for the great bug report! It will be fixed in the next release by #2441