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

Returning null for a string in a resolver converts it to the empty string in the response #559

Closed
nikolasburk opened this issue Sep 14, 2017 · 1 comment
Assignees
Milestone

Comments

@nikolasburk
Copy link
Member

For bug reports, please fill in the next sections:

What is the current behavior?

Consider a resolver function that's set up as follows:

type AuthenticatedEmailUserPayload {
  id: ID
}

extend type Query {
  authenticatedEmailUser: AuthenticatedEmailUserPayload!
}

And implemented like this:

module.exports = function authenticatedEmailUser(event) {
    return {data: {id: null}}
}

The client receives an empty string for the value of id:

{
  "data": {
    "authenticatedEmailUser": {
      "id": ""
    }
  }
}

Please share the relevant part of your project (GraphQL schema, functions, permissions, ...) for easier reproduction

See above

If applicable, share the query, mutation or subscription for reproduction

{
  authenticatedEmailUser {
    id
  }
}

What is the expected behavior?

The client should receive this response:

{
  "data": {
    "authenticatedEmailUser": {
      "id":  null
    }
  }
}
@marktani
Copy link
Contributor

This is fixed now. 🙂

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

4 participants