Repository navigation
fix(schema-org): allow null to opt out of default values - #687
Merged
Merged
Conversation
2 of 6 tasks
…tation 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:05
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 escape hatch — properties likesku,priceValidUntil, andurlwere always auto-populated with no way to suppress them. Setting a property tonullnow acts as an explicit opt-out sentinel, preventing default injection.Changes:
setIfEmpty: Guard changed from truthyvalue→value != null, so falsy-but-valid defaults (0,false,'') are also injected correctlystripNullProperties(array handling): Arrays now usespliceinstead ofdeleteon numeric indices —deletecreates sparse arrays where holes serialize back tonullinJSON.stringify, defeating the opt-outgraph.tssecond pass: Split the resolve loop into two phases — allresolveRootNodehandlers run first, then null stripping and_resolvercleanup happen in a separate pass. Previously, earlier nodes had their sentinels erased before later resolvers could observe them, making behavior iteration-order dependent✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.