Schema Class @preview
Implements
Methods
| Name | Description | |
|---|---|---|
| constructor(context: SchemaContext): Schema | Constructs an empty Schema (without a SchemaKey) in the provided context. | |
| constructor(context: SchemaContext, key: SchemaKey, alias: string): Schema | Constructs an empty Schema with the given key in the provided context. | |
| constructor(context: SchemaContext, name: string, alias: string, readVersion: number, writeVersion: number, minorVersion: number): Schema | Constructs an empty Schema with the given name and version in the provided context. | |
| fromJSON(schemaProps: SchemaProps): Promise<void> | Loads the schema header (name, version alias, label and description) from the input SchemaProps | |
| fromJSONSync(schemaProps: SchemaProps): void | Loads the schema header (name, version alias, label and description) from the input SchemaProps | |
| getConstant(name: string): Promise<Constant | undefined> | Shortcut for calling getItem with Constant. | |
| getCustomAttributeClass(name: string): Promise<CustomAttributeClass | undefined> | Shortcut for calling getItem with CustomAttributeClass. | |
| getEntityClass(name: string): Promise<EntityClass | undefined> | Shortcut for calling getItem with EntityClass. | |
| getEnumeration(name: string): Promise<Enumeration | undefined> | Shortcut for calling getItem with Enumeration. | |
| getFormat(name: string): Promise<Format | undefined> | Shortcut for calling getItem with Format. | |
| getInvertedUnit(name: string): Promise<InvertedUnit | undefined> | Shortcut for calling getItem with InvertedUnit. | |
| getItem(name: string): Promise<SchemaItem | undefined> | Gets an item from within this schema. | |
| getItem<T extends SchemaItem>(name: string, itemConstructor: T): Promise<InstanceType<T> | undefined> | Gets an item from within this schema. | |
| getItems(): Iterable<SchemaItem> | Returns all of the loaded items in this schema. | |
| getItems<T extends SchemaItem>(itemConstructor: T): Iterable<InstanceType<T>> | Returns all of the loaded items in this schema. | |
| getItemSync(name: string): SchemaItem | undefined | Gets an item from within this schema. | |
| getItemSync<T extends SchemaItem>(name: string, itemConstructor: T): InstanceType<T> | undefined | Gets an item from within this schema. | |
| getKindOfQuantity(name: string): Promise<KindOfQuantity | undefined> | Shortcut for calling getItem with KindOfQuantity. | |
| getMixin(name: string): Promise<Mixin | undefined> | Shortcut for calling getItem with Mixin. | |
| getPhenomenon(name: string): Promise<Phenomenon | undefined> | Shortcut for calling getItem with Phenomenon. | |
| getPropertyCategory(name: string): Promise<PropertyCategory | undefined> | Shortcut for calling getItem with PropertyCategory. | |
| getReference(refSchemaName: string): Promise<Schema | undefined> | Gets a referenced schema by name | |
| getReferenceNameByAlias(alias: string): string | undefined | Gets a referenced schema by alias | |
| getReferenceSync(refSchemaName: string): Schema | undefined | Gets a referenced schema by name | |
| getRelationshipClass(name: string): Promise<RelationshipClass | undefined> | Shortcut for calling getItem with RelationshipClass. | |
| getSchemaItemKey(fullName: string): SchemaItemKey | Returns a SchemaItemKey given the item name and the schema it belongs to | |
| getStructClass(name: string): Promise<StructClass | undefined> | Shortcut for calling getItem with StructClass. | |
| getUnit(name: string): Promise<Unit | undefined> | Shortcut for calling getItem with Unit. | |
| getUnitSystem(name: string): Promise<UnitSystem | undefined> | Shortcut for calling getItem with UnitSystem. | |
| lookupItem(key: string | Readonly<SchemaItemKey>): Promise<SchemaItem | undefined> | Attempts to find a schema item within this schema or a (directly) referenced schema | |
| lookupItem<T extends SchemaItem>(key: string | Readonly<SchemaItemKey>, itemConstructor: T): Promise<InstanceType<T> | undefined> | Attempts to find a schema item within this schema or a (directly) referenced schema | |
| lookupItemSync(key: string | Readonly<SchemaItemKey>): SchemaItem | undefined | Attempts to find a schema item within this schema or a (directly) referenced schema | |
| lookupItemSync<T extends SchemaItem>(key: string | Readonly<SchemaItemKey>, itemConstructor: T): InstanceType<T> | undefined | Attempts to find a schema item within this schema or a (directly) referenced schema | |
| toJSON(): SchemaProps | Save this Schema's properties to an object for serializing to JSON. | |
| toXml(schemaXml: Document): Promise<Document> | Converts the schema to a DOM XML Document. | |
| fromJson(jsonObj: string | object, context: SchemaContext): Promise<Schema> Static | ||
| fromJsonSync(jsonObj: string | object, context: SchemaContext): Schema Static | Completely loads the Schema from the input json. | |
| startLoadingFromJson(jsonObj: string | object, context: SchemaContext): Promise<SchemaInfo> Static | Completely loads the SchemaInfo from the input json and starts loading the entire schema. |
Properties
| Name | Type | Description | |
|---|---|---|---|
| alias Accessor ReadOnly | string | ||
| context Accessor ReadOnly | SchemaContext | Returns the schema context this schema is within. | |
| currentECSpecMajorVersion Accessor Static ReadOnly | number | ||
| currentECSpecMinorVersion Accessor Static ReadOnly | number | ||
| customAttributes Accessor ReadOnly | CustomAttributeSet | undefined | ||
| description Accessor ReadOnly | string | undefined | ||
| fullName Accessor ReadOnly | string | Returns the schema name. | |
| isDynamic Accessor ReadOnly | boolean | Returns whether this schema is dynamic schema | |
| label Accessor ReadOnly | string | undefined | ||
| minorVersion Accessor ReadOnly | number | ||
| name Accessor ReadOnly | string | ||
| originalECSpecMajorVersion Accessor ReadOnly | number | undefined | ||
| originalECSpecMinorVersion Accessor ReadOnly | number | undefined | ||
| readVersion Accessor ReadOnly | number | ||
| references Readonly | Schema[] | ||
| schema Accessor ReadOnly | Schema | Returns the schema. | |
| schemaKey Accessor ReadOnly | SchemaKey | ||
| writeVersion Accessor ReadOnly | number |
Defined in
Last Updated: 28 April, 2026
Found something wrong, missing, or unclear on this page? Raise an issue in our repo.