Fix can-reach-null-producer?
for union field
#416
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi Walmart Team!
In Clashapp.co, we've faced an issue when the
::null
values remain in the response, for example:We expected the whole submap to collapse into
nil
because of the nested::null
value. At least it was so before we updated from 1.0 to 1.1.While investigating that, I noticed that only happens to the fields which are of the union type. In our case, the field was the
VideoCommentActivity
which is a member of the globalActivity
type:The problem is, the
can-reach-null-producer?
function in thecom.walmartlabs.lacinia.schema
namespaces doesn't take unions into account and skips them. As a result, it always returns False, so the following check:will always be False as well, and the null values won't be collapsed.
With this PR, the function takes into account the members of the union fields and processes them. You're welcome to review and share you feedback. Also, should I add any tests for that, please give me a hit what would the best way of doing that (what do you expect and where, etc).
Thank you,
Ivan.