feat(js): add schema-based per-field nullable support for xlang #3100
+28
−2
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.
Why?
JavaScript xlang schema-based struct serialization currently treats all fields as nullable and always writes a per-field null flag.
This introduces unnecessary overhead when a field is known to be non-nullable by schema design.
What does this PR do?
nullablesupport for JS xlang struct serialization.nullable: falseis explicitly specified:nullorundefined(includes field name).StructTypeInfofield schema typing to allownullable?: boolean.null.nullablekeep existing behavior.Related issues
Does this PR introduce any user-facing change?
Yes.
This PR introduces an opt-in schema-level configuration (
nullable: false) for JS xlang serialization.Existing schemas are unaffected unless
nullable: falseis explicitly set.Benchmark
This change is opt-in and only affects schema-based fields explicitly marked as
nullable: false.No performance regression is expected for existing schemas.