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
new Attribute(
typeName,
attrName,
options): Attribute;Defined in: packages/model/src/schema/Attribute.ts:24
Creates a new Attribute descriptor.
Parameters
| Parameter | Type | Description |
|---|---|---|
typeName | string | The name of the type this attribute belongs to |
attrName | string | The name of this attribute |
options | PmAttributeSpec | The attribute specification from the schema |
Returns
Attribute
Accessors
default
Get Signature
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
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
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
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
get validate(): (value) => void;Defined in: packages/model/src/schema/Attribute.ts:55
The validation function for this attribute, if any.
Returns
(value): void;Parameters
| Parameter | Type |
|---|---|
value | string | number | boolean |
Returns
void