TreeNodeSchemaCore Interface

Packages > @fluidframework/tree > TreeNodeSchemaCore

Data common to all tree node schema.

Signature

/** @sealed */
export interface TreeNodeSchemaCore<out Name extends string, out Kind extends NodeKind, out ImplicitlyConstructable extends boolean, out Info = unknown>

Type Parameters

Parameter Constraint Default Description
Name string
Kind NodeKind
ImplicitlyConstructable boolean
Info unknown

Remarks

Implementation detail of TreeNodeSchema which should be accessed instead of referring to this type directly.

Properties

Property Alerts Modifiers Type Description
childTypes System readonly ReadonlySet<TreeNodeSchema>

All possible schema that a direct child of a node with this schema could have.

Equivalently, this is also all schema directly referenced when defining this schema's allowed child types, which is also the same as the set of schema referenced directly by the Info type parameter and the info property. This property is simply re-exposing that information in an easier to traverse format consistent across all node kinds.

identifier readonly Name Unique (within a document's schema) identifier used to associate nodes with their schema.
implicitlyConstructable readonly ImplicitlyConstructable When constructing insertable content, data that could be passed to the node's constructor can be used instead of an Unhydrated node iff implicitlyConstructable is true.
info readonly Info Data used to define this schema.
kind readonly Kind

Property Details

childTypes

All possible schema that a direct child of a node with this schema could have.

Equivalently, this is also all schema directly referenced when defining this schema’s allowed child types, which is also the same as the set of schema referenced directly by the Info type parameter and the info property. This property is simply re-exposing that information in an easier to traverse format consistent across all node kinds.

This API is reserved for internal system use and should not be imported directly. It may change at any time without notice.

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

Signature

readonly childTypes: ReadonlySet<TreeNodeSchema>;

Type: ReadonlySet<TreeNodeSchema >

Remarks

Some kinds of nodes may have additional restrictions on children: this set simply enumerates all directly referenced schema, and can be use to walk over all referenced schema types.

This set cannot be used before the schema in it have been defined: more specifically, when using lazy schema references (for example to make foreword references to schema which have not yet been defined), users must wait until after the schema are defined to access this set.

identifier

Unique (within a document’s schema) identifier used to associate nodes with their schema.

Signature

readonly identifier: Name;

Type: Name

Remarks

This is used when encoding nodes, and when decoding nodes to re-associate them with the schema. Since this decoding may happen in a different version of the application (or even a different application altogether), this identifier should generally correspond to some specific semantics for the data (how to interpret the node with this identifier). Any time the semantics change such that data would be misinterpreted if the old semantics were applied (for example the units of a value are changed), it is best practice to pick a new identifier.

implicitlyConstructable

When constructing insertable content, data that could be passed to the node’s constructor can be used instead of an Unhydrated node iff implicitlyConstructable is true.

Signature

readonly implicitlyConstructable: ImplicitlyConstructable;

Type: ImplicitlyConstructable

info

Data used to define this schema.

Signature

readonly info: Info;

Type: Info

Remarks

The format depends on the kind of node it is for. For example, the “object” node kind could store the field schema here.

kind

Signature

readonly kind: Kind;

Type: Kind