Skip to content

Add failing test for ParseIDs middleware inside mutation - #150

Open
howleysv wants to merge 1 commit into
absinthe-graphql:mainfrom
howleysv:parseids-mutation
Open

Add failing test for ParseIDs middleware inside mutation#150
howleysv wants to merge 1 commit into
absinthe-graphql:mainfrom
howleysv:parseids-mutation

Conversation

@howleysv

Copy link
Copy Markdown

I'm not sure exactly how this can be fixed, but figured submitting a failing test could be useful to illustrate the issue.

Basically, the ParseIDs middleware fails when resolving objects below the root payload object in relay mutations.

@howleysv

Copy link
Copy Markdown
Author

Test error is

  1) test parsing nested ids works with nested id args (Absinthe.Relay.Node.ParseIDsTest)
     test/lib/absinthe/relay/node/parse_ids_test.exs:501
     ** (RuntimeError) Can't find ParseIDs schema root argument :input
     code: |> Absinthe.run(SchemaClassic)
     stacktrace:
       (absinthe_relay) lib/absinthe/relay/node/parse_ids.ex:240: Absinthe.Relay.Node.ParseIDs.find_schema_root!/2
       (absinthe_relay) lib/absinthe/relay/node/parse_ids.ex:216: Absinthe.Relay.Node.ParseIDs.parse/3
       (absinthe_relay) lib/absinthe/relay/node/parse_ids.ex:198: Absinthe.Relay.Node.ParseIDs.call/2
       (absinthe) lib/absinthe/phase/document/execution/resolution.ex:230: Absinthe.Phase.Document.Execution.Resolution.reduce_resolution/1
       (absinthe) lib/absinthe/phase/document/execution/resolution.ex:185: Absinthe.Phase.Document.Execution.Resolution.do_resolve_field/3
       (absinthe) lib/absinthe/phase/document/execution/resolution.ex:170: Absinthe.Phase.Document.Execution.Resolution.do_resolve_fields/6
       (absinthe) lib/absinthe/phase/document/execution/resolution.ex:88: Absinthe.Phase.Document.Execution.Resolution.walk_result/5
       (absinthe) lib/absinthe/phase/document/execution/resolution.ex:280: Absinthe.Phase.Document.Execution.Resolution.build_result/3
       (absinthe) lib/absinthe/phase/document/execution/resolution.ex:170: Absinthe.Phase.Document.Execution.Resolution.do_resolve_fields/6
       (absinthe) lib/absinthe/phase/document/execution/resolution.ex:88: Absinthe.Phase.Document.Execution.Resolution.walk_result/5
       (absinthe) lib/absinthe/phase/document/execution/resolution.ex:280: Absinthe.Phase.Document.Execution.Resolution.build_result/3
       (absinthe) lib/absinthe/phase/document/execution/resolution.ex:170: Absinthe.Phase.Document.Execution.Resolution.do_resolve_fields/6
       (absinthe) lib/absinthe/phase/document/execution/resolution.ex:88: Absinthe.Phase.Document.Execution.Resolution.walk_result/5
       (absinthe) lib/absinthe/phase/document/execution/resolution.ex:67: Absinthe.Phase.Document.Execution.Resolution.perform_resolution/3
       (absinthe) lib/absinthe/phase/document/execution/resolution.ex:24: Absinthe.Phase.Document.Execution.Resolution.resolve_current/3
       (absinthe) lib/absinthe/pipeline.ex:366: Absinthe.Pipeline.run_phase/3
       (absinthe) lib/absinthe.ex:103: Absinthe.run/3
       test/lib/absinthe/relay/node/parse_ids_test.exs:520: (test)

@benwilson512

Copy link
Copy Markdown
Contributor

Ah. Yeah, if you're using the classic form it's expecting :input to be there, but that should be restricted to just mutation fields. Good catch, will fix!

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

Successfully merging this pull request may close these issues.

2 participants