Skip to content

Conversation

CraigMacomber
Copy link
Contributor

Description

Make handling of node schema options like metadata more consistent across the various API layers.

Reviewer Guidance

The review process is outlined on this wiki page.

@CraigMacomber CraigMacomber requested a review from a team as a code owner October 9, 2025 20:00
@Copilot Copilot AI review requested due to automatic review settings October 9, 2025 20:00
@CraigMacomber CraigMacomber requested review from a team as code owners October 9, 2025 20:00
@github-actions github-actions bot added area: dds Issues related to distributed data structures area: dds: tree area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct changeset-present public api change Changes to a public API base: main PRs targeted against main branch labels Oct 9, 2025
Copy link
Contributor

@Copilot 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

Updates SchemaFactory methods to consistently support node schema metadata options across all APIs. The PR adds an optional options parameter to array, map, and object methods in the base SchemaFactory class, and updates the corresponding record method in SchemaFactoryBeta, making metadata handling consistent with SchemaFactoryAlpha.

  • Adds TCustomMetadata generic parameter and optional options parameter to named schema factory methods
  • Consolidates metadata handling by passing a unified nodeOptions object to underlying schema creation functions
  • Updates all API report files to reflect the new method signatures with consistent metadata support

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/framework/fluid-framework/api-report/*.api.md Updated method signatures to include optional metadata parameters
packages/dds/tree/api-report/*.api.md Updated method signatures and type definitions for consistent metadata support
packages/dds/tree/src/simple-tree/api/schemaFactory*.ts Added options parameters and refactored to use unified nodeOptions objects
packages/dds/tree/src/simple-tree/node-kinds//.ts Updated schema creation functions to accept unified options objects
packages/dds/tree/src/test/simple-tree/core/treeNodeSchema.spec.ts Updated test to use new API signature
.changeset/all-glasses-grab.md Added changeset documenting the new consistent metadata support

/* ImplicitlyConstructable */ ImplicitlyConstructable,
/* Info */ T,
/* TConstructorExtra */ never,
/* TConstructorExtra */ undefined,
Copy link

Copilot AI Oct 9, 2025

Choose a reason for hiding this comment

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

The change from never to undefined for TConstructorExtra should be documented. This affects the type system behavior and could impact consumers who rely on the previous never type.

Copilot uses AI. Check for mistakes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Record nodes can be constructed with no constructor parameter: explicitly indicating that here saves on typecasting where this is used in schema factory beta.

public static readonly identifierFieldKeys: readonly FieldKey[] = identifierFieldKeys;
public static readonly allowUnknownOptionalFields: boolean = allowUnknownOptionalFields;
public static readonly allowUnknownOptionalFields: boolean =
nodeOptions.allowUnknownOptionalFields ?? false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is allowUnknownOptionalFields optional? Was this to avoid breaking an API or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is a setting nodes can opt into. We do not want to force every single schema declaration in existence to explicitly have to pass an options object and provide this property. That would be a breaking change, but also a really annoying API.

@CraigMacomber
Copy link
Contributor Author

I broke out the non-public subset of this into #25685 to do first. After that, some work on defaults for options may be done before doing the public parts.

CraigMacomber added a commit that referenced this pull request Oct 14, 2025
## Description

Expose schema metadata in more internal and beta API surfaces.

This is a subset of
#25656, but with the
public SchemaFactory changes reverted.
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 public api change Changes to a public API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants