Repository navigation
fix(schema-org): allow null to opt out of default values - #688
Merged
harlan-zw merged 2 commits intoMar 10, 2026
Merged
Conversation
2 of 6 tasks
Co-authored-by: harlan-zw <[email protected]>
Copilot
AI
changed the title
[WIP] Fix schema-org to allow null to opt out of default values
fix(schema-org): allow null to opt out of default values
Mar 10, 2026
harlan-zw
marked this pull request as ready for review
March 10, 2026 13:34
harlan-zw
added a commit
that referenced
this pull request
Mar 10, 2026
* fix(schema-org): allow null to opt out of default values When a user sets a schema-org property to null, it is now removed from the final output instead of being overwritten by setIfEmpty defaults or inheritMeta. null acts as an explicit opt-out sentinel that is preserved through the full resolution pipeline and stripped only after all resolvers (including resolveRootNode) have run. Closes #548 * fix(schema-org): allow null to opt out of default values (#687) * Initial plan * fix(schema-org): address CodeRabbit issues with null opt-out implementation Co-authored-by: harlan-zw <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: harlan-zw <[email protected]> * fix(schema-org): allow null to opt out of default values (#688) * Initial plan * fix(schema-org): delete _resolver before stripping null properties Co-authored-by: harlan-zw <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: harlan-zw <[email protected]> --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: harlan-zw <[email protected]>
1 task
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.
Resolves #548
❓ Type of change
📚 Description
setIfEmptyhad no opt-out mechanism — fields likesku,priceValidUntil, andurlwould always receive injected defaults. Setting a property tonullnow acts as an explicit sentinel to suppress default injection.Changes:
setIfEmpty— guard changed from falsy to=== undefinedsonullblocks injection while0,false, and''are now valid defaultsstripNullProperties— added array-aware path: splices outnullentries instead ofdelete(which creates sparse arrays thatJSON.stringifyre-serializes asnull)graph.tscleanup loop — deferredstripNullProperties+delete _resolverto a second pass after allresolveRootNodecalls complete, so later resolvers see sentinels on earlier nodes;_resolveris now deleted before stripping to prevent traversal into resolver objects💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.