Skip to content
This repository has been archived by the owner on May 16, 2019. It is now read-only.

Adding Context parameter to resolver causes errors in introspection #47

Closed
mdnorman opened this issue Jan 6, 2019 · 3 comments
Closed

Comments

@mdnorman
Copy link
Contributor

mdnorman commented Jan 6, 2019

Adding a Context parameter to a resolver seems to work properly during execution, but introspection comes back with an object that fails to be parsed properly by eg GraphiQL.

Example resolver:

mutation("registerAccount") {
  accessRule { ctx ->
    println("rule context: $ctx")
    null
  }

  suspendResolver { ctx: Context, email: String ->
    println("resolver context: $ctx")
    println("email: $email")
  }
}

When executing the function, it does the right thing:

rule context: com.github.pgutkowski.kgraphql.Context@200146c2
resolver context: com.github.pgutkowski.kgraphql.Context@200146c2
email: some-person@example.com

However, GraphiQL gives the following error when introspecting the schema: Error: Unknown type reference: {"kind":"OBJECT","name":null,"ofType":null}

In addition, executing with "extra" parameters shows that ctx is incorrectly included in the parameter list: `registerAccount does support arguments [ctx, email]. Found arguments [accountName, email]

@mdnorman
Copy link
Contributor Author

mdnorman commented Jan 6, 2019

Created a PR: #48

@pgutkowski
Copy link
Owner

Merged #48, It will be included in upcoming 0.3.1 release, planned for today.

@mdnorman
Copy link
Contributor Author

mdnorman commented Jan 9, 2019

Awesome, thanks!

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

No branches or pull requests

2 participants