-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: Add null support #6
Conversation
Code is mostly copy-pasted from the PR graphql-go#536 - main difference is that I haven't copied over a couple of new tests, and that I permitted null within arrays (unanswered question in original PR, and I see no reason for it too).
@@ -1188,7 +1188,7 @@ func TestVariables_ListsAndNullability_DoesNotAllowListOfNonNullsToContainNull(t | |||
{ | |||
Message: `Variable "$input" got invalid value ` + | |||
`["A",null,"B"].` + | |||
"\nIn element #1: Expected \"String!\", found null.", | |||
"\nIn element #2: Expected \"String!\", found null.", |
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.
question: do you know why was this saying element #1 was null before?
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.
no idea
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.
Looking good overall. Just a few things to take a look at bellow 🙂
if tmp == nil { | ||
return nullValue{} // Null value | ||
} else { | ||
return tmp | ||
} |
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.
suggestion: No else
needed here since if
ends with a return
.
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.
Seems to be the norm in this repo, will leave as is unless we decide to take full ownership of the project
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.
If it's copy pasted code I'll agree but if it's our code I would change it to the idiomatic form.
Code is mostly copy-pasted from the PR graphql-go#536 - main difference is that I haven't copied over a couple of new tests, and that I permitted null within arrays (unanswered question in original PR, and I see no reason for it too).
Partially resolves sourcenetwork/defradb#410
Code is mostly copy-pasted from the PR graphql-go#536 by https://github.com/mpenick - main difference is that I haven't copied over a couple of new tests, and that I permitted null within arrays (unanswered question in original PR, and I see no reason for it too). I have changed that code as little as possible otherwise. Builds and tests pass.
Follows the GQL spec as far as I can see (Nulls got added here: graphql/graphql-spec#83)
I have incorporated this feature into a Defra branch and it seems to be working https://github.com/sourcenetwork/defradb/compare/sisley/feat/I410-filter-by-nil?expand=1 (got more tests to write though, will finish those before merging this)