Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new in 2.3.1: Arrays of inputs previously "prepared" now not "prepared" #4934

Closed
ryanquanz opened this issue Apr 25, 2024 · 4 comments
Closed

Comments

@ryanquanz
Copy link

ryanquanz commented Apr 25, 2024

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

@rmosolgo
Copy link
Owner

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.

@layerssss
Copy link

I also ran into this and can confirm master has it fixed.

@rmosolgo
Copy link
Owner

Thanks for confirming that -- 🚢 2.3.2 to RubyGems! Please let me know if you run into any more trouble with that version.

@ryanquanz
Copy link
Author

Thanks @rmosolgo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants