new in 2.3.1: Arrays of inputs previously "prepared" now not "prepared"
ryanquanz opened this issue ยท 4 comments
Describe the bug
Previously when a mutation argument was an array of inputs #prepare
was called on all of inputs in the array. Since 2.3.1 these inputs are left unprepared.
Versions
graphql
version: 2.3.1
rails
: 7.1.3.2
GraphQL schema
Include relevant types and fields (in Ruby is best, in GraphQL IDL is ok). Any custom extensions, etc?
class MyMutation < GraphQL::Schema::RelayClassicMutation
argument :my_argument, [MyInput], required: true
field :foo, String, null: false
def execute(**arguments)
raise if arguments[:my_argument] != ["prepared"]
{ foo: "bar" }
end
end
class MyInput < GraphQL::Schema::InputObject
argument :baz, required: true
def prepare
"prepared"
end
end
class MutationType < GraphQL::Schema::Object
field :my_mutation, mutation: MyMutation
end
class QueryType < GraphQL::Schema::Object ; end
class ApplicationSchema < GraphQL::Schema
query QueryType
mutation MutationType
end
GraphQL query
Example GraphQL query and response (if query execution is involved)
mutation Foo {
myMutation(myArgument: [ { baz: "bar" } ]) {
foo
}
}
{ "foo": "bar" }
Expected behavior
Input is prepared
Actual behavior
Input is not prepared
Thanks for reporting this! I merged a fix in #4933 and I'll release 2.3.2 tomorrow. If you get a chance to try master, please let me know if you can confirm that it's fixed for you.
I also ran into this and can confirm master has it fixed.
Thanks for confirming that -- ๐ข 2.3.2 to RubyGems! Please let me know if you run into any more trouble with that version.