-
Notifications
You must be signed in to change notification settings - Fork 6
Fix null input handling #3403
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
Merged
Merged
Fix null input handling #3403
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This comment was marked as resolved.
This comment was marked as resolved.
🗞 GraphQL SummaryView schema changes@@ -2601,9 +2601,9 @@
presetInventory: Boolean
registryOfDialectsCode: String
registryOfLanguageVarietiesCode: String
- """Only languages with these sensitivities"""
+ """Only these sensitivities"""
sensitivity: [Sensitivity!]
}
input LanguageListInput {
@@ -4861,9 +4861,9 @@
presetInventory: Boolean
primaryLocation: LocationFilters
primaryPartnership: PartnershipFilters
- """Only projects with these sensitivities"""
+ """Only these sensitivities"""
sensitivity: [Sensitivity!]
"""Only projects matching these statuses"""
status: [ProjectStatus!]
|
b10b9b1
to
85a5eac
Compare
GraphQL's / Nest's decorators have `nullable` option, which means the value can be null or omitted. Which naturally translates to null or undefined in JS. We actually care about this distinction, though, especially on update mutations. undefined means no change. null means clear the value. We carelessly allowed both meaningly that nulls could mistakenly be stored in lots of spots that are unexpected. Granted, this only would happen in Neo4j, as Gel's schema checks would prevent this. Going forward we have a new `optional` option as a sibling to `nullable`. `optional` lets the field be omitted or undefined. GraphQL can still give us nulls, but be will we convert them to undefined. `nullable` continues to let null & undefined through.
6e062e6
to
906f47d
Compare
CarsonF
commented
Apr 27, 2025
9fc6395
to
a24814c
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Handle GraphQL nulls from "optional" fields as undefined.
GraphQL's / Nest's decorators have
nullable
option, which means the value can be null or omitted - which naturally translates to null or undefined in JS.We actually care about this distinction, though, especially on update mutations.
undefined means no change.
null means clear the value.
We carelessly allowed both meaningly that nulls could mistakenly be stored in lots of spots that are unexpected.
Granted, this only would happen in Neo4j, as Gel's schema checks would prevent this.
Going forward we have a new
optional
option as a sibling tonullable
.optional
lets the field be omitted or undefined. GraphQL can still give us nulls, but be will we convert them to undefined.nullable
continues to let null & undefined through.I also added
null
types where we actually expect/allow nulls.I also created
ListField
to help dedupe items, and convert empty lists to undefined (for filters), and to disallow empty arrays where expected.