Skip to main content

SchemaFactoryAlpha Class

SchemaFactory with additional alpha APIs.

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/tree/alpha.

For more information about our API support guarantees, see here.

Signature

export declare class SchemaFactoryAlpha<out TScope extends string | undefined = string | undefined, TName extends number | string = string> extends SchemaFactory<TScope, TName>

Extends: SchemaFactory<TScope, TName>

Type Parameters

Parameter Constraint Default Description
TScope string | undefined string | undefined
TName number | string string

Static Properties

Property Alerts Modifiers Type Description
identifier Alpha readonly <const TCustomMetadata = unknown>(props?: Omit<import("../schemaTypes.js").FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => import("../schemaTypes.js").FieldSchemaAlpha<import("../schemaTypes.js").FieldKind.Identifier, import("../leafNodeSchema.js").LeafSchema<"string", string> & import("../simpleSchema.js").SimpleLeafNodeSchema, TCustomMetadata> Like identifier but static and a factory function that can be provided FieldProps.
leaves Alpha readonly readonly [import("../leafNodeSchema.js").LeafSchema<"string", string> & import("../simpleSchema.js").SimpleLeafNodeSchema, import("../leafNodeSchema.js").LeafSchema<"number", number> & import("../simpleSchema.js").SimpleLeafNodeSchema, import("../leafNodeSchema.js").LeafSchema<"boolean", boolean> & import("../simpleSchema.js").SimpleLeafNodeSchema, import("../leafNodeSchema.js").LeafSchema<"null", null> & import("../simpleSchema.js").SimpleLeafNodeSchema, import("../leafNodeSchema.js").LeafSchema<"handle", import("@fluidframework/core-interfaces").IFluidHandle<unknown>> & import("../simpleSchema.js").SimpleLeafNodeSchema] Make a field optional instead of the default, which is required.
optional Alpha readonly <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../schemaTypes.js").FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => import("../schemaTypes.js").FieldSchemaAlpha<import("../schemaTypes.js").FieldKind.Optional, T, TCustomMetadata> Make a field optional instead of the default, which is required.
optionalRecursive Alpha readonly <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../schemaTypes.js").FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => import("./typesUnsafe.js").FieldSchemaAlphaUnsafe<import("../schemaTypes.js").FieldKind.Optional, T, TCustomMetadata> optional except tweaked to work better for recursive types. Use with ValidateRecursiveSchema for improved type safety.
required Alpha readonly <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../schemaTypes.js").FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => import("../schemaTypes.js").FieldSchemaAlpha<import("../schemaTypes.js").FieldKind.Required, T, TCustomMetadata> Make a field explicitly required.

Property Details

identifier

Like identifier but static and a factory function that can be provided FieldProps.

This API is provided as an alpha preview and may change without notice.

For more information about our API support guarantees, see here.

Signature

static readonly identifier: <const TCustomMetadata = unknown>(props?: Omit<import("../schemaTypes.js").FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => import("../schemaTypes.js").FieldSchemaAlpha<import("../schemaTypes.js").FieldKind.Identifier, import("../leafNodeSchema.js").LeafSchema<"string", string> & import("../simpleSchema.js").SimpleLeafNodeSchema, TCustomMetadata>;

Type: <const TCustomMetadata = unknown>(props?: Omit<import("../schemaTypes.js").FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => import("../schemaTypes.js").FieldSchemaAlpha<import("../schemaTypes.js").FieldKind.Identifier, import("../leafNodeSchema.js").LeafSchema<"string", string> & import("../simpleSchema.js").SimpleLeafNodeSchema, TCustomMetadata>

leaves

Make a field optional instead of the default, which is required.

This API is provided as an alpha preview and may change without notice.

For more information about our API support guarantees, see here.

Signature

static readonly leaves: readonly [import("../leafNodeSchema.js").LeafSchema<"string", string> & import("../simpleSchema.js").SimpleLeafNodeSchema, import("../leafNodeSchema.js").LeafSchema<"number", number> & import("../simpleSchema.js").SimpleLeafNodeSchema, import("../leafNodeSchema.js").LeafSchema<"boolean", boolean> & import("../simpleSchema.js").SimpleLeafNodeSchema, import("../leafNodeSchema.js").LeafSchema<"null", null> & import("../simpleSchema.js").SimpleLeafNodeSchema, import("../leafNodeSchema.js").LeafSchema<"handle", import("@fluidframework/core-interfaces").IFluidHandle<unknown>> & import("../simpleSchema.js").SimpleLeafNodeSchema];

Type: readonly [import("../leafNodeSchema.js").LeafSchema<"string", string> & import("../simpleSchema.js").SimpleLeafNodeSchema, import("../leafNodeSchema.js").LeafSchema<"number", number> & import("../simpleSchema.js").SimpleLeafNodeSchema, import("../leafNodeSchema.js").LeafSchema<"boolean", boolean> & import("../simpleSchema.js").SimpleLeafNodeSchema, import("../leafNodeSchema.js").LeafSchema<"null", null> & import("../simpleSchema.js").SimpleLeafNodeSchema, import("../leafNodeSchema.js").LeafSchema<"handle", import("@fluidframework/core-interfaces").IFluidHandle<unknown>> & import("../simpleSchema.js").SimpleLeafNodeSchema]

optional

Make a field optional instead of the default, which is required.

This API is provided as an alpha preview and may change without notice.

For more information about our API support guarantees, see here.

Signature

static readonly optional: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../schemaTypes.js").FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => import("../schemaTypes.js").FieldSchemaAlpha<import("../schemaTypes.js").FieldKind.Optional, T, TCustomMetadata>;

Type: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../schemaTypes.js").FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => import("../schemaTypes.js").FieldSchemaAlpha<import("../schemaTypes.js").FieldKind.Optional, T, TCustomMetadata>

optionalRecursive

optional except tweaked to work better for recursive types. Use with ValidateRecursiveSchema for improved type safety.

This API is provided as an alpha preview and may change without notice.

For more information about our API support guarantees, see here.

Signature

static readonly optionalRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../schemaTypes.js").FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => import("./typesUnsafe.js").FieldSchemaAlphaUnsafe<import("../schemaTypes.js").FieldKind.Optional, T, TCustomMetadata>;

Type: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../schemaTypes.js").FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => import("./typesUnsafe.js").FieldSchemaAlphaUnsafe<import("../schemaTypes.js").FieldKind.Optional, T, TCustomMetadata>

Remarks

This version of optional has fewer type constraints to work around TypeScript limitations, see Unenforced. See ValidateRecursiveSchema for additional information about using recursive schema.

required

Make a field explicitly required.

This API is provided as an alpha preview and may change without notice.

For more information about our API support guarantees, see here.

Signature

static readonly required: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../schemaTypes.js").FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => import("../schemaTypes.js").FieldSchemaAlpha<import("../schemaTypes.js").FieldKind.Required, T, TCustomMetadata>;

Type: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../schemaTypes.js").FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => import("../schemaTypes.js").FieldSchemaAlpha<import("../schemaTypes.js").FieldKind.Required, T, TCustomMetadata>

Remarks

Fields are required by default, but this API can be used to make the required nature explicit in the schema, and allows associating custom properties with the field.