API Reference > ecschema-Metadata > Metadata > Schema Schema Class Beta Implements CustomAttributeContainerProps Methods Name Description 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. constructor(context: SchemaContext): Schema Constructs an empty Schema (without a SchemaKey) in the provided context. addCustomAttribute(customAttribute: CustomAttribute): void Protected addItem<T extends SchemaItem<T>>(item: T): void Protected addReference(refSchema: Schema): Promise<void> Protected addReferenceSync(refSchema: Schema): void Protected createConstant(name: string): Promise<Constant> Protected Creates a Constant with the provided name in this schema. createConstantSync(name: string): Constant Protected createCustomAttributeClass(name: string, modifier?: ECClassModifier): Promise<CustomAttributeClass> Protected Creates a CustomAttributeClass with the provided name in this schema. createCustomAttributeClassSync(name: string, modifier?: ECClassModifier): CustomAttributeClass Protected createEntityClass(name: string, modifier?: ECClassModifier): Promise<EntityClass> Protected Creates a EntityClass with the provided name in this schema. createEntityClassSync(name: string, modifier?: ECClassModifier): EntityClass Protected createEnumeration(name: string, primitiveType?: Integer | String): Promise<Enumeration> Protected Creates an Enumeration with the provided name in this schema. createEnumerationSync(name: string, primitiveType?: Integer | String): Enumeration Protected createFormat(name: string): Promise<Format> Protected Creates an Format with the provided name in this schema. createFormatSync(name: string): Format Protected createInvertedUnit(name: string): Promise<InvertedUnit> Protected Creates a Inverted Unit with the provided name in this schema. createInvertedUnitSync(name: string): InvertedUnit Protected createKindOfQuantity(name: string): Promise<KindOfQuantity> Protected Creates an KindOfQuantity with the provided name in this schema. createKindOfQuantitySync(name: string): KindOfQuantity Protected createMixinClass(name: string): Promise<Mixin> Protected Creates a Mixin with the provided name in this schema. createMixinClassSync(name: string): Mixin Protected createPhenomenon(name: string): Promise<Phenomenon> Protected Creates a Phenomenon with the provided name in this schema. createPhenomenonSync(name: string): Phenomenon Protected createPropertyCategory(name: string): Promise<PropertyCategory> Protected Creates an PropertyCategory with the provided name in this schema. createPropertyCategorySync(name: string): PropertyCategory Protected createRelationshipClass(name: string, modifier?: ECClassModifier): Promise<RelationshipClass> Protected Creates a RelationshipClass with the provided name in this schema. createRelationshipClassSync(name: string, modifier?: ECClassModifier): RelationshipClass Protected createStructClass(name: string, modifier?: ECClassModifier): Promise<StructClass> Protected Creates a StructClass with the provided name in this schema. createStructClassSync(name: string, modifier?: ECClassModifier): StructClass Protected createUnit(name: string): Promise<Unit> Protected Creates a Unit with the provided name in this schema. createUnitSync(name: string): Unit Protected createUnitSystem(name: string): Promise<UnitSystem> Protected Creates a UnitSystem with the provided name in this schema. createUnitSystemSync(name: string): UnitSystem Protected fromJSON(schemaProps: SchemaProps): Promise<void> fromJSONSync(schemaProps: SchemaProps): void getClasses(): IterableIterator<ECClass> getItem<T extends SchemaItem<T>>(name: string): Promise<undefined | T> Gets an item from within this schema. getItemSync<T extends SchemaItem<T>>(name: string): undefined | T Gets an item from within this schema. getItems<T extends AnySchemaItem>(): IterableIterator<T> getReference<T extends Schema<T>>(refSchemaName: string): Promise<undefined | T> getReferenceNameByAlias(alias: string): undefined | string getReferenceSync<T extends Schema<T>>(refSchemaName: string): undefined | T getSchemaItemKey(fullName: string): SchemaItemKey Returns a SchemaItemKey given the item name and the schema it belongs to lookupItem<T extends SchemaItem<T>>(key: string | Readonly<SchemaItemKey>): Promise<undefined | T> Attempts to find a schema item within this schema or a (directly) referenced schema lookupItemSync<T extends SchemaItem<T>>(key: string | Readonly<SchemaItemKey>): undefined | T Attempts to find a schema item within this schema or a (directly) referenced schema setVersion(readVersion?: number, writeVersion?: number, minorVersion?: number): void Sets the version of the SchemaKey identifying the 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 Properties Name Type Description _alias Protected undefined | string _description Protected undefined | string _label Protected undefined | string _schemaKey Protected undefined | SchemaKey alias Accessor ReadOnly string context Accessor ReadOnly SchemaContext Returns the schema context this schema is within. customAttributes Accessor ReadOnly undefined | CustomAttributeSet description Accessor ReadOnly undefined | string fullName Accessor ReadOnly string Returns the schema name. label Accessor ReadOnly undefined | string minorVersion Accessor ReadOnly number name Accessor ReadOnly string readVersion Accessor ReadOnly number references Readonly Schema[] schema Accessor ReadOnly Schema Returns the schema. schemaKey Accessor ReadOnly SchemaKey writeVersion Accessor ReadOnly number Defined in core/ecschema-metadata/src/Metadata/Schema.ts Line 42 Last Updated: 12 June, 2024