Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[String] returns [] on nil instead of null #556

Closed
leebenson opened this issue Feb 20, 2019 · 2 comments
Closed

[String] returns [] on nil instead of null #556

leebenson opened this issue Feb 20, 2019 · 2 comments
Labels
bug Something isn't working v0.8.2 Fixed in 0.8.2

Comments

@leebenson
Copy link

Expected Behaviour

Given this type:

type Test {
  test1: [String]
  test2: [String!]
  test3: [String]!
  test4: [String!]!
}

I'd expect returning nil in each resolver to produce:

{
  "data": {
    "test": {
      "test1": null,
      "test2": null,
      "test3": [],
      "test4": []
    }
  }
}

Actual Behavior

This is what's returned instead:

{
  "data": {
    "test": {
      "test1": [],
      "test2": [],
      "test3": [],
      "test4": []
    }
  }
}

graphql/graphql-spec#171 for context.

Is this an error or by design? Thanks in advance.

@vektah
Copy link
Collaborator

vektah commented Feb 20, 2019

Looks like a bug. Go treats nils like empty arrays so it would be an easy one to make.

@vektah vektah added the bug Something isn't working label Feb 20, 2019
@rodrigo-brito
Copy link
Contributor

Same problem here! Any update about it? 😞

@vektah vektah added the v0.8.2 Fixed in 0.8.2 label Mar 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v0.8.2 Fixed in 0.8.2
Projects
None yet
Development

No branches or pull requests

3 participants