Prisma1: Scalar Payloads for Resolver Functions

Created on 5 Oct 2017  路  4Comments  路  Source: prisma/prisma1

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 }

Most helpful comment

Looks like a great and natural addition to resolver functions!

All 4 comments

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 :)

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.

Looks like a great and natural addition to resolver functions!

Further discuss in #743.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MitkoTschimev picture MitkoTschimev  路  3Comments

schickling picture schickling  路  3Comments

notrab picture notrab  路  3Comments

marktani picture marktani  路  3Comments

AlessandroAnnini picture AlessandroAnnini  路  3Comments