Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Error thrown when resolving null for a nullable object type #22

Closed
alexstrat opened this issue Mar 3, 2019 · 1 comment
Closed

Error thrown when resolving null for a nullable object type #22

alexstrat opened this issue Mar 3, 2019 · 1 comment
Labels

Comments

@alexstrat
Copy link
Contributor

When a field is an object type that is not non-nullable, resolving it to null throws an error, while it's expected to just resolve null.

const typeDefs = `
  type Query {
    foo: Foo
  }
  type Foo {
    bar: Int
  }
`;

const resolvers = {
  Query: {
    foo: () => {
      return null;
    }
  }
};


const query = gql`
  query {
    foo {
      bar
    }
  }
`;

// reactive-graphql
$graphql(schema, query)
// -> error reactive-graphql: resolver emitted empty value 

// reference graphql-js
execute(schema, query)
// -> {"data":{"foo":null}} 

https://codesandbox.io/s/4qvw8y31yw

@mesosphere-frontend-ci
Copy link

🎉 This issue has been resolved in version 3.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

No branches or pull requests

2 participants