Closed
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new Tree.ensureSchema helper function that allows users to explicitly tag insertable content with a schema identifier. This resolves ambiguity when content could match multiple schemas with similar structure. The implementation uses a new schemaSymbol property to store the intended schema identifier on objects before insertion.
Key changes:
- Introduces
schemaSymbolfor tagging insertable content with schema identifiers - Adds
TreeAlpha.ensureSchema()API to programmatically tag content - Updates
getPossibleTypes()to respect theschemaSymbolwhen present
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/dds/tree/src/simple-tree/core/withType.ts | Defines the new schemaSymbol constant with documentation |
| packages/dds/tree/src/simple-tree/core/index.ts | Exports the schemaSymbol for internal use |
| packages/dds/tree/src/simple-tree/index.ts | Exports the schemaSymbol to the public API |
| packages/dds/tree/src/index.ts | Exports the schemaSymbol at the package root |
| packages/dds/tree/src/simple-tree/unhydratedFlexTreeFromInsertable.ts | Updates getPossibleTypes() to check and honor the schemaSymbol when determining possible types |
| packages/dds/tree/src/shared-tree/treeAlpha.ts | Implements the ensureSchema() method on the TreeAlpha interface |
| packages/dds/tree/src/test/simple-tree/unhydratedFlexTreeFromInsertable.spec.ts | Adds tests for getPossibleTypes() with the type symbol |
| packages/dds/tree/src/test/simple-tree/api/treeNodeApi.spec.ts | Adds comprehensive tests for the ensureSchema() API |
| packages/dds/tree/api-report/tree.alpha.api.md | Updates the API report with the new exports |
Contributor
|
🔗 Found some broken links! 💔 Run a link check locally to find them. See linkcheck output |
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.
See the changeset for details.