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

make distinguishable about between null and empty list #1023

Closed
vvakame opened this issue Feb 9, 2020 · 3 comments
Closed

make distinguishable about between null and empty list #1023

vvakame opened this issue Feb 9, 2020 · 3 comments

Comments

@vvakame
Copy link
Collaborator

vvakame commented Feb 9, 2020

What happened?

I want distinguish about mutation A and B in resolver.

mutation A {
  # update tags to zero length list
  updateFoo(id: "Foo:1", input: { name: "foo", tags: []) { ... }
}
mutation B {
  # don't modify tags. only update about "name".
  updateFoo(id: "Foo:1", input: { name: "foo") { ... }
}

Is there a way I can do this now?
current generated code is below. I think We can't do that now... 🤔

	var err error
	res := make([]ID, len(vSlice))
	for i := range vSlice {
		res[i], err = ec.unmarshalFoo(ctx, vSlice[i])
		if err != nil {
			return nil, err
		}
	}
	return res, nil

versions

  • gqlgen version? master/HEAD
  • go version? go version go1.13.7 darwin/amd64
  • dep or go modules? go modules
@ngorohov
Copy link

ngorohov commented Mar 4, 2020

Hi there!
I have same question.
Having nullable field I can't determine difference between "set to nil" and "do nothing", because in input data structure this field will be "nil" in both cases.

@stale
Copy link

stale bot commented May 3, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@lwc
Copy link
Member

lwc commented Jul 10, 2020

Fixed via #1242

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

No branches or pull requests

3 participants