GithubHelp home page GithubHelp logo

Comments (12)

benwilson512 avatar benwilson512 commented on May 9, 2024

@dre1080 just wanted to give you an update. We've been looking through this and this bug has uncovered a slightly more general problem with handling complex input types. I'll be working on an improved implementation tomorrow, as we need this functionality ourselves too.

We hope to have it fixed very soon.

from absinthe.

dre1080 avatar dre1080 commented on May 9, 2024

@benwilson512 thanks. Looking forward to seeing this fixed

from absinthe.

benwilson512 avatar benwilson512 commented on May 9, 2024

@dre1080 hey! can you try now against master? The latest merge should have fixed this issue.

from absinthe.

dre1080 avatar dre1080 commented on May 9, 2024

@benwilson512 it seems like its working now πŸ˜„
All that's left is Relay integration for clientMutationId

from absinthe.

benwilson512 avatar benwilson512 commented on May 9, 2024

Yup we've got a whole library in the works for relay support, https://github.com/absinthe-graphql/absinthe_relay

from absinthe.

dre1080 avatar dre1080 commented on May 9, 2024

I am however getting this response when testing mutations,

{"errors":[{"message":"Variable `input_0.clientMutationId': Not present in schema","locations":[{"line":1,"column":0}]},{"message":"Variable `input_0.clientMutationId' (String): Not provided","locations":[{"line":1,"column":0}]}],"data":{}}

Same schema as before but added field :client_mutation_id, non_null(:string)

from absinthe.

benwilson512 avatar benwilson512 commented on May 9, 2024

Can you show an example test case? What's a minimal schema, variable value, and document needed to reproduce?

from absinthe.

dre1080 avatar dre1080 commented on May 9, 2024

Here's the schema I'm testing with:

defmodule API.Graph.Schema do
  use Absinthe.Schema

  alias API.Resolver

  object :user do
    field :id, :id
    field :email, :string
    field :name, :string
  end

  object :create_user_payload, name: "CreateUserPayload" do
    field :user, :user
    field :client_mutation_id, non_null(:string)
  end

  input_object :create_user_input, name: "CreateUserInput" do
    field :email, non_null(:string)
    field :name, non_null(:string)
    field :client_mutation_id, non_null(:string)
  end

  mutation do
    @desc "Create a user"
    field :create_user, type: :create_user_payload do
      arg :input, non_null(:create_user_input)

      resolve &Resolver.User.create/2
    end
  end

  query do
    field :viewer, :user do
      resolve &Resolver.User.current/2
    end
  end
end

This is the request payload:

{
  query: "mutation createUserMutation($input_0:CreateUserInput){createUser(input:$input_0){clientMutationId}}"
  variables: {input_0: {clientMutationId: "0", email: "[email protected]", name: "John"}}
}

from absinthe.

benwilson512 avatar benwilson512 commented on May 9, 2024

Ah hm maybe variables aren't run through the adapters? Hold up let me see if I can confirm.

from absinthe.

benwilson512 avatar benwilson512 commented on May 9, 2024

Yeah it's definitely that adapters aren't being used to coerce inner
variable values. I'll patch that in the morning, good catch thanks!

On Wednesday, March 9, 2016, andΓΆ [email protected] wrote:

Here's the schema I'm testing with:

defmodule API.Graph.Schema do
use Absinthe.Schema

alias API.Resolver

object :user do
field :id, :id
field :email, :string
field :name, :string
end

object :create_user_payload, name: "CreateUserPayload" do
field :user, :user
field :client_mutation_id, non_null(:string)
end

input_object :create_user_input, name: "CreateUserInput" do
field :email, non_null(:string)
field :name, non_null(:string)
field :client_mutation_id, non_null(:string)
end

mutation do
@desc "Create a user"
field :create_user, type: :create_user_payload do
arg :input, non_null(:create_user_input)

  resolve &Resolver.User.create/2
end

end

query do
field :viewer, :user do
resolve &Resolver.User.current/2
end
end
end

This is the request payload:

{
query: "mutation createUserMutation($input_0:CreateUserInput){createUser(input:$input_0){clientMutationId}}"
variables: {input_0: {clientMutationId: "0", email: "[email protected] javascript:_e(%7B%7D,'cvml','[email protected]');", name: "John"}}
}

β€”
Reply to this email directly or view it on GitHub
#65 (comment)
.

from absinthe.

benwilson512 avatar benwilson512 commented on May 9, 2024

Hey give it a shot now.

from absinthe.

bruce avatar bruce commented on May 9, 2024

@benwilson512 Closing this because I think this is handled. Reopen if necessary.

from absinthe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.