-
Notifications
You must be signed in to change notification settings - Fork 14
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
Ignore value nullability #28
Conversation
d15c154
to
18ffa84
Compare
@brabeji LGTM but lint fails in CI. Could you fix that? I probably will change that lint rule later tbh… |
@eturino Definitely, I was just probing if this is a valid change. Will fix asap |
I am thinking about this change a bit more. Indeed this link should not be responsible to ensure null/non-nulls. While your change fixes it for that case, it wouldn't do it on a nested field. Maybe what we can do is to change the behaviour of
We call this at the beginning of apollo-link-scalars/src/lib/parser.ts Line 68 in 7499d45
We would have to adapt this test
What do you think @brabeji ? |
I've added an issue #29 to cover the removal of the nullability checks. |
Yes, that makes sense. I wasn't digging deep enough! I have some issues with the resulting TS type, which I was unable to solve yet, though. See https://github.com/eturino/apollo-link-scalars/pull/28/files#diff-a5b54a3eee29198834db8832951d216eR69 I've "adapted" 🔪 the test and broken coverage. I'll fix that later today. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. I'll have a look this evening and see if we can avoid that
I've compared coverage results with master and I can't see any increase in uncovered lines count. Does it look like -0.2% might be expected change when removing code? |
@brabeji export function ensureNullableType(
type: GraphQLOutputType | GraphQLInputType
): GraphQLNullableType {
return isNonNullType(type) ? type.ofType : type;
} and that should work fine. If I am not mistaken, that is what btw, re the percentage of lines tested, do not worry. The deleted file was fully tested so taking it out of the equation will always reduce the overall % of tested lines. |
@all-contributors please add @brabeji for bug, tests, code and idea |
I've put up a pull request to add @brabeji! 🎉 |
Bug fix
The link validates the response data but does not account for
@skip
and@include
directives.The link now disregards result value type nullability. We should just convert scalars and don't bother with the nullability validation (apollo client does this). This fixes the link raising errors for non-nullable fields even when they're skipped with
@skip
directive. This should also take care of@include
directive, but this is yet to be tested.