From 0bd51b851eb85c8cf3ae8da072254592a4da43fb Mon Sep 17 00:00:00 2001 From: "Craig Macomber (Microsoft)" <42876482+CraigMacomber@users.noreply.github.com> Date: Mon, 9 Jun 2025 15:05:42 -0700 Subject: [PATCH 1/5] Add non static overrides for schema factory alpha --- .../src/simple-tree/api/schemaFactoryAlpha.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/packages/dds/tree/src/simple-tree/api/schemaFactoryAlpha.ts b/packages/dds/tree/src/simple-tree/api/schemaFactoryAlpha.ts index d89c53cc7620..0373dd28c02e 100644 --- a/packages/dds/tree/src/simple-tree/api/schemaFactoryAlpha.ts +++ b/packages/dds/tree/src/simple-tree/api/schemaFactoryAlpha.ts @@ -172,6 +172,26 @@ export class SchemaFactoryAlpha< */ public static readonly identifier = schemaStatics.identifier; + /** + * {@inheritDoc SchemaStatics.optional} + */ + public override readonly leaves = schemaStatics.leaves; + + /** + * {@inheritDoc SchemaStatics.optional} + */ + public override readonly optional = schemaStatics.optional; + + /** + * {@inheritDoc SchemaStatics.required} + */ + public override readonly required = schemaStatics.required; + + /** + * {@inheritDoc SchemaStatics.optionalRecursive} + */ + public override readonly optionalRecursive = schemaStatics.optionalRecursive; + /** * Define a {@link TreeNodeSchema} for a {@link TreeMapNode}. * From e539629e43897ca15d4a395c35cf5566bcbf7d50 Mon Sep 17 00:00:00 2001 From: "Craig Macomber (Microsoft)" <42876482+CraigMacomber@users.noreply.github.com> Date: Mon, 9 Jun 2025 15:10:04 -0700 Subject: [PATCH 2/5] Add non-static overrides to schema factory alpha --- packages/dds/tree/api-report/tree.alpha.api.md | 12 +++++++++++- .../tree/src/simple-tree/api/schemaFactoryAlpha.ts | 4 ++-- .../api-report/fluid-framework.alpha.api.md | 12 +++++++++++- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/packages/dds/tree/api-report/tree.alpha.api.md b/packages/dds/tree/api-report/tree.alpha.api.md index 6e606c6a45c6..f1f73a1a7c89 100644 --- a/packages/dds/tree/api-report/tree.alpha.api.md +++ b/packages/dds/tree/api-report/tree.alpha.api.md @@ -765,6 +765,7 @@ export class SchemaFactoryAlpha(name: Name, allowedTypes: T, options?: NodeSchemaOptions): ArrayNodeCustomizableSchemaUnsafe, T, TCustomMetadata>; static readonly identifier: (props?: Omit, "defaultProvider"> | undefined) => FieldSchemaAlpha_2 & SimpleLeafNodeSchema_2, TCustomMetadata>; static readonly leaves: readonly [LeafSchema_2<"string", string> & SimpleLeafNodeSchema_2, LeafSchema_2<"number", number> & SimpleLeafNodeSchema_2, LeafSchema_2<"boolean", boolean> & SimpleLeafNodeSchema_2, LeafSchema_2<"null", null> & SimpleLeafNodeSchema_2, LeafSchema_2<"handle", IFluidHandle> & SimpleLeafNodeSchema_2]; + readonly leaves: readonly [LeafSchema_2<"string", string> & SimpleLeafNodeSchema_2, LeafSchema_2<"number", number> & SimpleLeafNodeSchema_2, LeafSchema_2<"boolean", boolean> & SimpleLeafNodeSchema_2, LeafSchema_2<"null", null> & SimpleLeafNodeSchema_2, LeafSchema_2<"handle", IFluidHandle> & SimpleLeafNodeSchema_2]; mapAlpha(name: Name, allowedTypes: T, options?: NodeSchemaOptions): MapNodeCustomizableSchema, T, true, TCustomMetadata>; mapRecursive(name: Name, allowedTypes: T, options?: NodeSchemaOptions): MapNodeCustomizableSchemaUnsafe, T, TCustomMetadata>; objectAlpha, const TCustomMetadata = unknown>(name: Name, fields: T, options?: SchemaFactoryObjectOptions): ObjectNodeSchema, T, true, TCustomMetadata> & { @@ -775,11 +776,20 @@ export class SchemaFactoryAlpha(t: T, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2; (t: T_1, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2, TCustomMetadata_1>; }; + readonly optional: { + (t: T, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2; + (t: T_1, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2, TCustomMetadata_1>; + }; static readonly optionalRecursive: (t: T, props?: Omit, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe_2; + readonly optionalRecursive: (t: T, props?: Omit, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe_2; static readonly required: { (t: T, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2; (t: T_1, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2, TCustomMetadata_1>; }; + readonly required: { + (t: T, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2; + (t: T_1, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2, TCustomMetadata_1>; + }; scopedFactory(name: T): SchemaFactoryAlpha, TNameInner>; } @@ -920,7 +930,7 @@ export namespace System_TableSchema { }), true, { readonly props: TPropsSchema; readonly id: FieldSchema_2, unknown>; - readonly cells: FieldSchema_2, "Row.cells">, NodeKind.Map, TreeMapNode_2 & WithType, "Row.cells">, NodeKind.Map, unknown>, MapNodeInsertableData_2, true, TCellSchema, undefined>, unknown>; + readonly cells: FieldSchemaAlpha_3, "Row.cells">, NodeKind.Map, TreeMapNode_2 & WithType, "Row.cells">, NodeKind.Map, unknown>, MapNodeInsertableData_2, true, TCellSchema, undefined>, unknown>; }>; // @system export function createTableSchema, const TRowSchema extends RowSchemaBase>(inputSchemaFactory: SchemaFactoryAlpha, _cellSchema: TCellSchema, columnSchema: TColumnSchema, rowSchema: TRowSchema): TreeNodeSchemaCore_2, "Table">, NodeKind.Object, true, { diff --git a/packages/dds/tree/src/simple-tree/api/schemaFactoryAlpha.ts b/packages/dds/tree/src/simple-tree/api/schemaFactoryAlpha.ts index 0373dd28c02e..d10c4da55ba7 100644 --- a/packages/dds/tree/src/simple-tree/api/schemaFactoryAlpha.ts +++ b/packages/dds/tree/src/simple-tree/api/schemaFactoryAlpha.ts @@ -148,7 +148,7 @@ export class SchemaFactoryAlpha< } /** - * {@inheritDoc SchemaStatics.optional} + * {@inheritDoc SchemaStatics.leaves} */ public static override readonly leaves = schemaStatics.leaves; @@ -173,7 +173,7 @@ export class SchemaFactoryAlpha< public static readonly identifier = schemaStatics.identifier; /** - * {@inheritDoc SchemaStatics.optional} + * {@inheritDoc SchemaStatics.leaves} */ public override readonly leaves = schemaStatics.leaves; diff --git a/packages/framework/fluid-framework/api-report/fluid-framework.alpha.api.md b/packages/framework/fluid-framework/api-report/fluid-framework.alpha.api.md index 982ef8cd3375..78961bacf598 100644 --- a/packages/framework/fluid-framework/api-report/fluid-framework.alpha.api.md +++ b/packages/framework/fluid-framework/api-report/fluid-framework.alpha.api.md @@ -1125,6 +1125,7 @@ export class SchemaFactoryAlpha(name: Name, allowedTypes: T, options?: NodeSchemaOptions): ArrayNodeCustomizableSchemaUnsafe, T, TCustomMetadata>; static readonly identifier: (props?: Omit, "defaultProvider"> | undefined) => FieldSchemaAlpha_2 & SimpleLeafNodeSchema_2, TCustomMetadata>; static readonly leaves: readonly [LeafSchema_2<"string", string> & SimpleLeafNodeSchema_2, LeafSchema_2<"number", number> & SimpleLeafNodeSchema_2, LeafSchema_2<"boolean", boolean> & SimpleLeafNodeSchema_2, LeafSchema_2<"null", null> & SimpleLeafNodeSchema_2, LeafSchema_2<"handle", IFluidHandle_2> & SimpleLeafNodeSchema_2]; + readonly leaves: readonly [LeafSchema_2<"string", string> & SimpleLeafNodeSchema_2, LeafSchema_2<"number", number> & SimpleLeafNodeSchema_2, LeafSchema_2<"boolean", boolean> & SimpleLeafNodeSchema_2, LeafSchema_2<"null", null> & SimpleLeafNodeSchema_2, LeafSchema_2<"handle", IFluidHandle_2> & SimpleLeafNodeSchema_2]; mapAlpha(name: Name, allowedTypes: T, options?: NodeSchemaOptions): MapNodeCustomizableSchema, T, true, TCustomMetadata>; mapRecursive(name: Name, allowedTypes: T, options?: NodeSchemaOptions): MapNodeCustomizableSchemaUnsafe, T, TCustomMetadata>; objectAlpha, const TCustomMetadata = unknown>(name: Name, fields: T, options?: SchemaFactoryObjectOptions): ObjectNodeSchema, T, true, TCustomMetadata> & { @@ -1135,11 +1136,20 @@ export class SchemaFactoryAlpha(t: T, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2; (t: T_1, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2, TCustomMetadata_1>; }; + readonly optional: { + (t: T, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2; + (t: T_1, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2, TCustomMetadata_1>; + }; static readonly optionalRecursive: (t: T, props?: Omit, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe_2; + readonly optionalRecursive: (t: T, props?: Omit, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe_2; static readonly required: { (t: T, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2; (t: T_1, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2, TCustomMetadata_1>; }; + readonly required: { + (t: T, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2; + (t: T_1, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2, TCustomMetadata_1>; + }; scopedFactory(name: T): SchemaFactoryAlpha, TNameInner>; } @@ -1288,7 +1298,7 @@ export namespace System_TableSchema { }), true, { readonly props: TPropsSchema; readonly id: FieldSchema_2, unknown>; - readonly cells: FieldSchema_2, "Row.cells">, NodeKind.Map, TreeMapNode_2 & WithType, "Row.cells">, NodeKind.Map, unknown>, MapNodeInsertableData_2, true, TCellSchema, undefined>, unknown>; + readonly cells: FieldSchemaAlpha_3, "Row.cells">, NodeKind.Map, TreeMapNode_2 & WithType, "Row.cells">, NodeKind.Map, unknown>, MapNodeInsertableData_2, true, TCellSchema, undefined>, unknown>; }>; // @system export function createTableSchema, const TRowSchema extends RowSchemaBase>(inputSchemaFactory: SchemaFactoryAlpha, _cellSchema: TCellSchema, columnSchema: TColumnSchema, rowSchema: TRowSchema): TreeNodeSchemaCore_2, "Table">, NodeKind.Object, true, { From fa95852216d2007feab218adb435653615ff3719 Mon Sep 17 00:00:00 2001 From: "Craig Macomber (Microsoft)" <42876482+CraigMacomber@users.noreply.github.com> Date: Mon, 9 Jun 2025 15:15:29 -0700 Subject: [PATCH 3/5] add requiredRecursive --- .../dds/tree/src/simple-tree/api/schemaFactoryAlpha.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/dds/tree/src/simple-tree/api/schemaFactoryAlpha.ts b/packages/dds/tree/src/simple-tree/api/schemaFactoryAlpha.ts index d10c4da55ba7..96f56e7c48f8 100644 --- a/packages/dds/tree/src/simple-tree/api/schemaFactoryAlpha.ts +++ b/packages/dds/tree/src/simple-tree/api/schemaFactoryAlpha.ts @@ -167,6 +167,11 @@ export class SchemaFactoryAlpha< */ public static override readonly optionalRecursive = schemaStatics.optionalRecursive; + /** + * {@inheritDoc SchemaStatics.requiredRecursive} + */ + public static override readonly requiredRecursive = schemaStatics.requiredRecursive; + /** * Like {@link SchemaFactory.identifier} but static and a factory function that can be provided {@link FieldProps}. */ @@ -192,6 +197,11 @@ export class SchemaFactoryAlpha< */ public override readonly optionalRecursive = schemaStatics.optionalRecursive; + /** + * {@inheritDoc SchemaStatics.requiredRecursive} + */ + public override readonly requiredRecursive = schemaStatics.requiredRecursive; + /** * Define a {@link TreeNodeSchema} for a {@link TreeMapNode}. * From fc7ddd690278eaa4182dd7e6d908b348831373e7 Mon Sep 17 00:00:00 2001 From: "Craig Macomber (Microsoft)" <42876482+CraigMacomber@users.noreply.github.com> Date: Mon, 9 Jun 2025 15:16:41 -0700 Subject: [PATCH 4/5] add changeset and update API reports --- .changeset/whole-days-argue.md | 10 ++++++++++ packages/dds/tree/api-report/tree.alpha.api.md | 2 ++ .../api-report/fluid-framework.alpha.api.md | 2 ++ 3 files changed, 14 insertions(+) create mode 100644 .changeset/whole-days-argue.md diff --git a/.changeset/whole-days-argue.md b/.changeset/whole-days-argue.md new file mode 100644 index 000000000000..7841b341e6e4 --- /dev/null +++ b/.changeset/whole-days-argue.md @@ -0,0 +1,10 @@ +--- +"fluid-framework": minor +"@fluidframework/tree": minor +"__section": tree +--- +Add overrides for more instance properties in SchemaFactoryAlpha + +[SchemaFactoryAlpha](https://fluidframework.com/docs/api/fluid-framework/schemafactoryalpha-class) provides proposed updates to several SchemaFactory APIs. With this change, it now exposes these not only for the static members but also the redundant instance properties for `leaves`, `optional`, `required` and `optionalRecursive`. + +Additionally an alpha override for `requiredRecursive` was added to both the statics and instance properties. diff --git a/packages/dds/tree/api-report/tree.alpha.api.md b/packages/dds/tree/api-report/tree.alpha.api.md index f1f73a1a7c89..50e9fce05e80 100644 --- a/packages/dds/tree/api-report/tree.alpha.api.md +++ b/packages/dds/tree/api-report/tree.alpha.api.md @@ -790,6 +790,8 @@ export class SchemaFactoryAlpha(t: T, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2; (t: T_1, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2, TCustomMetadata_1>; }; + static readonly requiredRecursive: (t: T, props?: Omit, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe_2; + readonly requiredRecursive: (t: T, props?: Omit, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe_2; scopedFactory(name: T): SchemaFactoryAlpha, TNameInner>; } diff --git a/packages/framework/fluid-framework/api-report/fluid-framework.alpha.api.md b/packages/framework/fluid-framework/api-report/fluid-framework.alpha.api.md index 78961bacf598..29e0e67378a4 100644 --- a/packages/framework/fluid-framework/api-report/fluid-framework.alpha.api.md +++ b/packages/framework/fluid-framework/api-report/fluid-framework.alpha.api.md @@ -1150,6 +1150,8 @@ export class SchemaFactoryAlpha(t: T, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2; (t: T_1, props?: Omit, "defaultProvider"> | undefined): FieldSchemaAlpha_2, TCustomMetadata_1>; }; + static readonly requiredRecursive: (t: T, props?: Omit, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe_2; + readonly requiredRecursive: (t: T, props?: Omit, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe_2; scopedFactory(name: T): SchemaFactoryAlpha, TNameInner>; } From 5a65688fbb356bcf9ecacafb459f2659b559c994 Mon Sep 17 00:00:00 2001 From: "Craig Macomber (Microsoft)" <42876482+CraigMacomber@users.noreply.github.com> Date: Tue, 10 Jun 2025 09:34:40 -0700 Subject: [PATCH 5/5] Update .changeset/whole-days-argue.md Co-authored-by: Joshua Smithrud <54606601+Josmithr@users.noreply.github.com> --- .changeset/whole-days-argue.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.changeset/whole-days-argue.md b/.changeset/whole-days-argue.md index 7841b341e6e4..d09931fee214 100644 --- a/.changeset/whole-days-argue.md +++ b/.changeset/whole-days-argue.md @@ -5,6 +5,7 @@ --- Add overrides for more instance properties in SchemaFactoryAlpha -[SchemaFactoryAlpha](https://fluidframework.com/docs/api/fluid-framework/schemafactoryalpha-class) provides proposed updates to several SchemaFactory APIs. With this change, it now exposes these not only for the static members but also the redundant instance properties for `leaves`, `optional`, `required` and `optionalRecursive`. +[SchemaFactoryAlpha](https://fluidframework.com/docs/api/fluid-framework/schemafactoryalpha-class) provides proposed updates to several SchemaFactory APIs. +It now exposes these not only for the static members but also the redundant instance properties for `leaves`, `optional`, `required` and `optionalRecursive`. Additionally an alpha override for `requiredRecursive` was added to both the statics and instance properties.