Skip to content

Type Editor


Type Editor / @type-editor/model / schema/Attribute / Attribute

Class: Attribute

Defined in: packages/model/src/schema/Attribute.ts:10

Represents an attribute descriptor for node and mark types. Encapsulates attribute metadata including default values and validation logic.

Constructors

Constructor

ts
new Attribute(
   typeName,
   attrName,
   options): Attribute;

Defined in: packages/model/src/schema/Attribute.ts:24

Creates a new Attribute descriptor.

Parameters

ParameterTypeDescription
typeNamestringThe name of the type this attribute belongs to
attrNamestringThe name of this attribute
optionsPmAttributeSpecThe attribute specification from the schema

Returns

Attribute

Accessors

default

Get Signature

ts
get default(): string | number | boolean;

Defined in: packages/model/src/schema/Attribute.ts:41

The default value for this attribute, or undefined if no default exists.

Returns

string | number | boolean


excludeFromMarkupComparison

Get Signature

ts
get excludeFromMarkupComparison(): boolean;

Defined in: packages/model/src/schema/Attribute.ts:62

Indicates whether this attribute should be excluded from markup comparison.

Returns

boolean


hasDefault

Get Signature

ts
get hasDefault(): boolean;

Defined in: packages/model/src/schema/Attribute.ts:48

Indicates whether this attribute has a default value.

Returns

boolean


isRequired

Get Signature

ts
get isRequired(): boolean;

Defined in: packages/model/src/schema/Attribute.ts:34

Indicates whether this attribute is required (has no default value).

Returns

boolean


validate

Get Signature

ts
get validate(): (value) => void;

Defined in: packages/model/src/schema/Attribute.ts:55

The validation function for this attribute, if any.

Returns
ts
(value): void;
Parameters
ParameterType
valuestring | number | boolean
Returns

void