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

A field that resolves to undefined is not present in response #17

Closed
alexstrat opened this issue Feb 4, 2019 · 1 comment
Closed

A field that resolves to undefined is not present in response #17

alexstrat opened this issue Feb 4, 2019 · 1 comment
Labels

Comments

@alexstrat
Copy link
Contributor

alexstrat commented Feb 4, 2019

If a resolver resolves undefined, the corresponding field is not present in the results' data, whereas according to specs the corresponding field should be null:

If result is null (or another internal value similar to null such as undefined or NaN), return null.

const resolvers = {
  Query : {
    foo: () => of(undefined),
    bar: () => of('bar')
  }
};
const res = await graphql(gql`{foo, bar}`, schema).toPromise();
// actual: res = { data : { bar: 'bar'}};
// expect: res = { data : { bar: 'bar', foo: null}};

Made me run into compatibility issues such as apollographql/apollo-client#4267

@alexstrat alexstrat changed the title Fields that resolve to undefined are not present in response A field that resolves to undefined is not present in response Feb 4, 2019
@mesosphere-frontend-ci
Copy link

🎉 This issue has been resolved in version 3.0.2 🎉

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