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

Scalar Payloads for Resolver Functions #729

Closed
marktani opened this issue Oct 5, 2017 · 4 comments
Closed

Scalar Payloads for Resolver Functions #729

marktani opened this issue Oct 5, 2017 · 4 comments
Assignees

Comments

@marktani
Copy link
Contributor

marktani commented Oct 5, 2017

What feature are you missing?

Returning a scalar value for a resolver function is not supported currently.

How could this feature look like in detail? Tradeoffs?

extend type Query {
  add(a: Int! b: Int!): Int!
}
module.exports = function sum(event) {
  const data = event.data

  const sum = data.a + data.b

  return {data: sum}
}

Currently, if you store such a resolver function, you receive this error message:

Schema Extension Error for function 'A': Must provide return type. For example: type MyPayload { someField: Boolean }

@danielkcz
Copy link
Contributor

I think this is kinda related to generally being able to return any existing type from your schema. Unless that's already working and I've missed it :)

@kbrandwijk
Copy link
Contributor

No, it's not. The primitive types are not linked to storage, and using them in resolver functions is something that's a lot different from integrating Resolver Function payload Types with the storage Types.

@schickling
Copy link
Member

Looks like a great and natural addition to resolver functions!

@marktani
Copy link
Contributor Author

Further discuss in #743.

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

6 participants