A field element defines a field in a list, struct, enum or bitmap.

Type Parameters

Hierarchy (view full)

Implements

Constructors

Properties

asOf?: `${number}.${number}`

The first Matter specification in which this element appears.

byteSize?: ByteSize

Applies to numeric types.

default?: FieldValue

The default value for the element.

description?: string

A short summary of the element.

details?: string

A paragraph summary of the element.

errors?: DefinitionError[]
id?: number

Fields must have IDs but they may be implied by the field's position in its parent.

isSeed?: boolean

Is this a "seed" element? These are global types and cluster elements defined in the core specification, without which we are fairly incapacitated.

isType?: boolean = true

Indicates that an element defines a datatype.

isTypeScope?: boolean

Indicates that an element may have type definitions as children.

metatype?: Metatype
name: string

The key used for storing this element. A "human appropriate" semantic differentiator.

operationalBase?: Model<BaseElement>

Normally base performs lookup based on type. If instead a model is installed it is used as the base.

The operational base also enables resolution from the operational base's tree. This enables resolution on operational models that are not installed in a parent hierarchy.

tag: Field = FieldElement.Tag
type?: string

If an element derives from another element, the name of the parent element goes here.

until?: `${number}.${number}`

The Matter specification revision in which this element was removed.

Reference to Matter specification document.

types: {
    [type: string]: (new (definition: any) => Model);
} = ...

Factory support. Populated by derivatives upon definition.

Accessors

  • get discriminator(): undefined | string
  • Obtain a discriminator that differentiates different models with the same name

    Returns undefined | string

  • get effectiveDefault(): any
  • The value to use as a default. The "default" field has a manually supplied value but this property decodes the default and/or generates a default from subfields.

    Returns any

  • get effectiveId(): undefined | number
  • Fields may omit their ID. In this case we use their index within the parent as the ID.

    Returns undefined | number

  • get fields(): {
        [k: string]: T;
    }
  • Active members keyed by property name.

    Returns {
        [k: string]: T;
    }

    • [k: string]: T
  • get key(): undefined | string
  • The key for bitmap fields is actually the constraint which defines the bit range. All other datatypes use the default key.

    Returns undefined | string

  • get overridesShadow(): undefined | true
  • Determine whether this element overrides key properties of its shadow.

    Returns undefined | true

  • get path(): string
  • The path ("." delimited) in the Matter tree.

    This is informational and generally tries to adhere to JS API conventions.

    Returns string

Methods

  • Freeze the model hierarchy rooted at this model.

    When using a model as operational schema we implement various optimizations that assume the schema is immutable. This function enforces that assumption.

    To make changes to a frozen model use clone.

    Returns void