FieldSchema Class
All policy for a specific field, including functionality that does not have to be kept consistent across versions or deterministic.
This can include policy for how to use this schema for "view" purposes, and well as how to expose editing APIs. Use SchemaFactory to create the FieldSchema instances, for example optional.
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 declare class FieldSchema<out Kind extends FieldKind = FieldKind, out Types extends ImplicitAllowedTypes = ImplicitAllowedTypes, out TCustomMetadata = unknown>
Type Parameters
Parameter | Constraint | Default | Description |
---|---|---|---|
Kind | FieldKind | FieldKind | |
Types | ImplicitAllowedTypes | ImplicitAllowedTypes | |
TCustomMetadata | unknown | Custom metadata properties to associate with the field. See custom. |
Remarks
All implementations of this are actually FieldSchemaAlpha which exposes some additional alpha APIs.
Constructors
Constructor | Description |
---|---|
(constructor)(kind, allowedTypes, props) | This class is @sealed : protected members like this constructor are for internal use only. Use SchemaFactory to create the FieldSchema instances. |
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
_typeCheck | MakeNominal | This class is used with instanceof, and therefore should have nominal typing. This field enforces that. | |
allowedTypes | readonly |
Types | What types of tree nodes are allowed in this field. |
allowedTypeSet | readonly |
ReadonlySet<TreeNodeSchema> | What types of tree nodes are allowed in this field. |
kind | readonly |
Kind | The kind of this field. Determines the multiplicity, viewing and editing APIs as well as the merge resolution policy. |
metadata | readonly |
FieldSchemaMetadata<TCustomMetadata> | Optional metadata to associate with the field. |
props | optional , readonly |
FieldProps<TCustomMetadata> | undefined | Optional properties associated with the field. |
requiresValue | readonly |
boolean | True if and only if, when constructing a node with this field, a value must be provided for it. |
Constructor Details
(constructor)
This class is @sealed
: protected members like this constructor are for internal use only. Use SchemaFactory to create the FieldSchema instances.
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
protected constructor(
kind: Kind,
allowedTypes: Types,
props?: FieldProps<TCustomMetadata> | undefined);
Parameters
Parameter | Modifiers | Type | Description |
---|---|---|---|
kind | Kind | ||
allowedTypes | Types | ||
props | optional | FieldProps<TCustomMetadata> | undefined |
Property Details
_typeCheck
This class is used with instanceof, and therefore should have nominal typing. This field enforces that.
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
protected _typeCheck: MakeNominal;
Type: MakeNominal
allowedTypes
What types of tree nodes are allowed in this field.
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
readonly allowedTypes: Types;
Type: Types
allowedTypeSet
What types of tree nodes are allowed in this field.
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
get allowedTypeSet(): ReadonlySet<TreeNodeSchema>;
Type: ReadonlySet<TreeNodeSchema>
Remarks
Counterpart to allowedTypes, with any lazy definitions evaluated.
kind
The kind of this field. Determines the multiplicity, viewing and editing APIs as well as the merge resolution policy.
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
readonly kind: Kind;
Type: Kind
metadata
Optional metadata to associate with the field.
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
get metadata(): FieldSchemaMetadata<TCustomMetadata>;
Type: FieldSchemaMetadata<TCustomMetadata>
Remarks
Note: this metadata is not persisted nor made part of the collaborative state; it is strictly client-local. Different clients in the same collaborative session may see different metadata for the same field.
props
Optional properties associated with the field.
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
readonly props?: FieldProps<TCustomMetadata> | undefined;
Type: FieldProps<TCustomMetadata> | undefined
requiresValue
True if and only if, when constructing a node with this field, a value must be provided for it.
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
readonly requiresValue: boolean;
Type: boolean