Skip to content

Add Tree.ensureSchema helper#25732

Closed
noencke wants to merge 1 commit intomicrosoft:mainfrom
noencke:schema-type
Closed

Add Tree.ensureSchema helper#25732
noencke wants to merge 1 commit intomicrosoft:mainfrom
noencke:schema-type

Conversation

@noencke
Copy link
Contributor

@noencke noencke commented Oct 22, 2025

See the changeset for details.

@noencke noencke requested a review from CraigMacomber October 22, 2025 21:14
@noencke noencke requested a review from a team as a code owner October 22, 2025 21:14
Copilot AI review requested due to automatic review settings October 22, 2025 21:14
@github-actions github-actions bot added area: dds Issues related to distributed data structures area: dds: tree public api change Changes to a public API base: main PRs targeted against main branch labels Oct 22, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 schemaSymbol for tagging insertable content with schema identifiers
  • Adds TreeAlpha.ensureSchema() API to programmatically tag content
  • Updates getPossibleTypes() to respect the schemaSymbol when 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

@noencke noencke requested a review from a team as a code owner October 22, 2025 22:27
@noencke noencke requested a review from a team as a code owner October 22, 2025 22:37
@github-actions github-actions bot added the area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct label Oct 22, 2025
@github-actions github-actions bot added the dependencies Pull requests that update a dependency file label Oct 22, 2025
@noencke noencke closed this Oct 22, 2025
@github-actions
Copy link
Contributor

🔗 Found some broken links! 💔

Run a link check locally to find them. See
https://github.com/microsoft/FluidFramework/wiki/Checking-for-broken-links-in-the-documentation for more information.

linkcheck output


> fluid-framework-docs-site@0.0.0 ci:check-links /home/runner/work/FluidFramework/FluidFramework/docs
> start-server-and-test "npm run serve -- --no-open" 3000 check-links

1: starting server using command "npm run serve -- --no-open"
and when url "[ 'http://127.0.0.1:3000' ]" is responding with HTTP status code 200
running tests using command "npm run check-links"


> fluid-framework-docs-site@0.0.0 serve
> docusaurus serve --no-open

[SUCCESS] Serving "build" directory at: http://localhost:3000/

> fluid-framework-docs-site@0.0.0 check-links
> linkcheck http://localhost:3000 --skip-file skipped-urls.txt

 ELIFECYCLE  Command failed with exit code 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: dds: tree area: dds Issues related to distributed data structures area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct base: main PRs targeted against main branch changeset-present dependencies Pull requests that update a dependency file public api change Changes to a public API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants