fix(neon): Allow extracting Json<Option<T>> when value is undefined#1130
Merged
kjvalencik merged 1 commit intomainfrom Jan 12, 2026
Merged
fix(neon): Allow extracting Json<Option<T>> when value is undefined#1130kjvalencik merged 1 commit intomainfrom
undefined#1130kjvalencik merged 1 commit intomainfrom
Conversation
|
| Branch | kv/json-option |
| Testbed | ubuntu-latest |
Click to view all benchmark results
| Benchmark | Latency | Benchmark Result nanoseconds (ns) (Result Δ%) | Lower Boundary nanoseconds (ns) (Limit %) | Upper Boundary nanoseconds (ns) (Limit %) | Throughput | Benchmark Result operations / second (ops/s) (Result Δ%) | Lower Boundary operations / second (ops/s) (Limit %) | Upper Boundary operations / second (ops/s) (Limit %) |
|---|---|---|---|---|---|---|---|---|
| JsFunction::bind | 📈 view plot 🚷 view threshold | 209.48 ns(+3.04%)Baseline: 203.29 ns | 182.96 ns (87.34%) | 406.59 ns (51.52%) | 📈 view plot 🚷 view threshold | 4,753,296.93 ops/s(-3.27%)Baseline: 4,913,759.54 ops/s | 0.00 ops/s (0.00%) | 5,405,135.49 ops/s (87.94%) |
| JsFunction::call | 📈 view plot 🚷 view threshold | 219.68 ns(+1.80%)Baseline: 215.80 ns | 194.22 ns (88.41%) | 431.61 ns (50.90%) | 📈 view plot 🚷 view threshold | 4,550,537.08 ops/s(-1.51%)Baseline: 4,620,462.24 ops/s | 0.00 ops/s (0.00%) | 5,082,508.47 ops/s (89.53%) |
| JsFunction::call_with | 📈 view plot 🚷 view threshold | 211.44 ns(+4.10%)Baseline: 203.10 ns | 182.79 ns (86.45%) | 406.21 ns (52.05%) | 📈 view plot 🚷 view threshold | 4,726,878.67 ops/s(-3.64%)Baseline: 4,905,637.96 ops/s | 0.00 ops/s (0.00%) | 5,396,201.76 ops/s (87.60%) |
| auto-exported-noop | 📈 view plot 🚷 view threshold | 28.59 ns(-3.49%)Baseline: 29.62 ns | 26.66 ns (93.25%) | 59.25 ns (48.26%) | 📈 view plot 🚷 view threshold | 34,951,722.76 ops/s(+2.28%)Baseline: 34,170,940.04 ops/s | 0.00 ops/s (0.00%) | 37,588,034.05 ops/s (92.99%) |
| hello-world | 📈 view plot 🚷 view threshold | 58.39 ns(+0.15%)Baseline: 58.30 ns | 52.47 ns (89.87%) | 116.60 ns (50.07%) | 📈 view plot 🚷 view threshold | 16,752,208.51 ops/s(-2.44%)Baseline: 17,170,662.37 ops/s | 0.00 ops/s (0.00%) | 18,887,728.61 ops/s (88.69%) |
| manually-exported-noop | 📈 view plot 🚷 view threshold | 27.82 ns(-2.03%)Baseline: 28.39 ns | 25.55 ns (91.86%) | 56.79 ns (48.99%) | 📈 view plot 🚷 view threshold | 35,839,475.97 ops/s(+1.79%)Baseline: 35,210,196.62 ops/s | 0.00 ops/s (0.00%) | 38,731,216.28 ops/s (92.53%) |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1130 +/- ##
=======================================
Coverage 83.16% 83.16%
=======================================
Files 80 80
Lines 5743 5739 -4
Branches 5743 5739 -4
=======================================
- Hits 4776 4773 -3
Misses 848 848
+ Partials 119 118 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
dherman
requested changes
Jan 5, 2026
Collaborator
dherman
left a comment
There was a problem hiding this comment.
This looks nice! It's subtle so I'm still not 100% confident about it, but I definitely know I want it.
I left a couple of questions and one suggestion for an additional test in my review.
dherman
approved these changes
Jan 12, 2026
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
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.
In JavaScript, it's very common to have optional arguments, especially with options object. Consider the following:
In this case, a user can call
createClient()without any options or they can call it with any subset of the keys fromClientOptions. If we want to model this in Neon, we can use theJsonextractor.This already works well, except for case where
optsisn't provided at all. For that, we want toOption<T>wrap the options.This works if the user explicitly passes
nullfor opts (since it is serialized as"null"), but fails if it'sundefined(not passed at all) because of the behavior ofJSON.stringify. This PR fixes it to match expectations.