Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

Unable to return model type from custom resolver #1001

Closed
wasd171 opened this issue Oct 23, 2017 · 1 comment
Closed

Unable to return model type from custom resolver #1001

wasd171 opened this issue Oct 23, 2017 · 1 comment

Comments

@wasd171
Copy link

wasd171 commented Oct 23, 2017

I am referring to this piece of documentation. I would like to create a getMyself query which would return the logged in user without needing id. My typings look as the following:

extend type Query {
    getMyself: User!
}

Current behavior
graphcool deploy fails with Schema Extension Error for function 'getMyself': Must provide return type. For example: type MyPayload { someField: Boolean }

Expected behavior?
It should be possible to return model from custom query or mutation.

@marktani
Copy link
Contributor

The concepts you're linking to are not quite uptodate. We'll update them soon.
Currently, it's not possible to return model types from resolver functions. You can refer to this example for a query that returns user data (like id or name): https://github.com/graphcool/templates/blob/master/auth/email-password/

Look at #743 for more information and an in-depth proposal.

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