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

Generated array field unmarshalling handles errors incorrectly for input types #487

trotterdylan opened this Issue Jan 3, 2019 · 0 comments


None yet
2 participants
Copy link

trotterdylan commented Jan 3, 2019

Expected Behaviour

If any element in an array field fails to unmarshal in an input type, it should be reported to clients as an error.

Actual Behavior

If an error occurs unmarshalling any of the array elements but the last, the error is ignored.

Minimal graphql.schema and models to reproduce

input Foo {
    dateAnswers: [Date!]

And the generated code:

			it.DateAnswers = make([]model.Date, len(rawIf1))
			for idx1 := range rawIf1 {
				err = (&it.DateAnswers[idx1]).UnmarshalGQL(rawIf1[idx1])
			if err != nil {
				return it, err

The error check should be inside the loop, not done at the end.

@vektah vektah added the bug label Jan 8, 2019

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