theharsh999 opened a new pull request, #3100:
URL: https://github.com/apache/fory/pull/3100

   ## 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?
   
   - Adds schema-based per-field `nullable` support for JS xlang struct 
serialization.
   - Preserves backward compatibility by treating fields as nullable by default.
   - When `nullable: false` is explicitly specified:
     - Skips writing the per-field null flag.
     - Throws a clear runtime error if the field value is `null` or `undefined` 
(includes field name).
   - Extends `StructTypeInfo` field schema typing to allow `nullable?: boolean`.
   - Adds a minimal unit test verifying:
     - Non-nullable fields throw on `null`.
     - Fields without `nullable` keep existing behavior.
   
   ## Related issues
   
   <!-- None -->
   
   ## 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: false` is explicitly set.
   
   - [x] Does this PR introduce any public API change?
   - [ ] Does this PR introduce any binary protocol compatibility change?
   
   ## 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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to