SimpleFieldSchema Interface
A simple, shallow representation of a schema for a field.
To use, import via @fluidframework/tree/alpha.
For more information about our API support guarantees, see here.
This type is "sealed," meaning that code outside of the library defining it should not implement or extend it. Future versions of this type may add members or make typing of readonly members more specific.
Signature
/** @sealed */
export interface SimpleFieldSchema<Type extends SchemaType = SchemaType>
Type Parameters
| Parameter | Constraint | Default | Description |
|---|---|---|---|
| Type | SchemaType | SchemaType |
Remarks
This definition is incomplete, and references child types by identifiers. To be useful, this generally needs to be used as a part of a complete SimpleTreeSchema, which contains backing definitions for each referenced identifier.
Properties
| Property | Alerts | Modifiers | Type | Description |
|---|---|---|---|---|
| isStagedOptional | Alpha | optional, readonly | Type extends SchemaType.Stored ? undefined : false | SchemaUpgrade | Indicates that this field is a staged optional field, allowing the view schema to be compatible with stored schema where the field is required (pre-upgrade) or optional (post-upgrade). New documents and schema upgrades will keep the field as required in the stored schema.
|
| kind | Alpha | readonly | FieldKind | The kind of tree field. |
| metadata | Alpha | readonly | FieldSchemaMetadata & (Type extends SchemaType.View ? unknown : { readonly custom?: undefined; readonly description?: undefined; }) | Metadata for this field schema, see FieldSchemaMetadata. |
| persistedMetadata | Alpha | optional, readonly | JsonCompatibleReadOnlyObject | undefined | Persisted metadata for this field schema. |
| simpleAllowedTypes | Alpha | readonly | ReadonlyMap<string, SimpleAllowedTypeAttributes<Type>> | Information about the allowed types under this field. |
Property Details
isStagedOptional
Indicates that this field is a staged optional field, allowing the view schema to be compatible with stored schema where the field is required (pre-upgrade) or optional (post-upgrade). New documents and schema upgrades will keep the field as required in the stored schema.
false if this is a view schema field that is not staged optional. Absent (undefined) if derived from a stored schema (where staged optional has no meaning).
false and undefined are both "not staged optional," but distinct: false means "view schema field, not staged optional" while undefined means "stored schema field." Consumers that need to check for staged optional should compare against false (e.g., !== false) rather than checking truthiness.
For more information about our API support guarantees, see here.
Signature
readonly isStagedOptional?: Type extends SchemaType.Stored ? undefined : false | SchemaUpgrade;
Type: Type extends SchemaType.Stored ? undefined : false | SchemaUpgrade
kind
The kind of tree field.
For more information about our API support guarantees, see here.
Signature
readonly kind: FieldKind;
Type: FieldKind
metadata
Metadata for this field schema, see FieldSchemaMetadata.
For more information about our API support guarantees, see here.
Signature
readonly metadata: FieldSchemaMetadata & (Type extends SchemaType.View ? unknown : {
readonly custom?: undefined;
readonly description?: undefined;
});
Type: FieldSchemaMetadata & (Type extends SchemaType.View ? unknown : { readonly custom?: undefined; readonly description?: undefined; })
Remarks
As this is the non-persisted portion of the metadata, it is forced to store only undefined in the SchemaType.Stored case.
persistedMetadata
Persisted metadata for this field schema.
For more information about our API support guarantees, see here.
Signature
readonly persistedMetadata?: JsonCompatibleReadOnlyObject | undefined;
Type: JsonCompatibleReadOnlyObject | undefined
Remarks
Like persistedMetadata but for fields. Set via persistedMetadata.
simpleAllowedTypes
Information about the allowed types under this field.
For more information about our API support guarantees, see here.
Signature
readonly simpleAllowedTypes: ReadonlyMap<string, SimpleAllowedTypeAttributes<Type>>;
Type: ReadonlyMap<string, SimpleAllowedTypeAttributes<Type>>
Remarks
Refers to the types by identifier. A SimpleTreeSchema is needed to resolve these identifiers to their schema definitions.