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

Error with schemas defined via macro with modern payloads #97

Open
avitex opened this issue Nov 22, 2017 · 2 comments
Open

Error with schemas defined via macro with modern payloads #97

avitex opened this issue Nov 22, 2017 · 2 comments

Comments

@avitex
Copy link
Contributor

avitex commented Nov 22, 2017

Based on this comment.

With this macro

defmodule SupportingSchema do
  defmacro __using__(flavor) do
    quote do
      use Absinthe.Schema
      use Absinthe.Relay.Schema, unquote(flavor)

      # ...
      
      mutation do
        payload field :update_foo do
          input do
            field :foo, :string
          end
          output do
            field :foo, :string
          end
          resolve fn %{foo: foo}, _ -> {:ok, %{foo: foo}} end
        end
      end

      # ...

    end
  end
end

And this definition

defmodule SchemaModern do
  use SupportingSchema, :modern # Classic works (assuming you also account for clientMutationId)
end

This query

"""
mutation updateFoo {
  updateFoo(input: {foo: "bar"}) {
    foo
  }
}
"""
|> Absinthe.run(SchemaModern)

Fails with

{:ok,
 %{errors: [%{locations: [],
      message: "Unknown argument \"input\" on field \"updateFoo\" of type \"RootMutationType\"."}]}}
@bruce
Copy link
Contributor

bruce commented Nov 22, 2017

@avitex To clarify, is this only present with the changes in #96?

@bruce bruce self-assigned this Nov 22, 2017
@avitex
Copy link
Contributor Author

avitex commented Nov 22, 2017

Nope, this is with master. I only discovered it while I was working on refactoring the tests in that PR.
Note that PR can be merged. The solution with the test works, once this this issue is resolved I'll continue refactoring the tests.

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

2 participants