You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support scalar nullable anyOf in the native object mechanism #942
On Node.js 26, a closed response object can use objectMechanism: 'native' until a single property uses anyOf for a nullable scalar. The compiler then uses the ordinary serializer for the whole response. Schema generators emit this shape for string | null, including string branches with constraints.
Minimal reproduction
Tested with fast-json-stringify 7.3.10 on main at a06b3a4 and Node.js 26.13.1.
The script prints Uses projection: false and the assertions pass.
Proposed behavior
Allow a supported scalar branch and a null branch to participate in projection. Reuse the existing ordered Ajv checks on the original value and preserve the output and errors of the ordinary serializer. A rewrite to type: ['string', 'null'] would drop the branch validation in this example.
This extends the eligible shapes from #936. General object and multi-branch unions can continue to fall back.
Activity