SchemaLoader Class @beta

A utility class for loading EC Schema objects using a function that returns schema json for a given schema name. Loaded schemas are held in memory within a schema context managed by SchemaLoader. The SchemaLoader object should be held in memory if multiple calls to getSchema or tryGetSchema is a possibility, thereby avoiding unnecessary schema retrievals from the function.

** Example **

// To use the schemas already in an iModel create a SchemaLoader that pulls schemas from the iModel // The SchemaLoader can load schemas from another location or you can create an empty context using the // SchemaContext constructor const loader = new SchemaLoader((name) => iModelDb.getSchemaProps(name)); const editor = new SchemaContextEditor(loader.context);

Is this concept needed no that backend and frontend will have contexts cached on the iModel?

Methods

Name Description
constructor(getSchema: SchemaPropsGetter): SchemaLoader    
getSchema(schemaName: string): Schema Get a schema by name  
tryGetSchema(schemaName: string): undefined | Schema Attempts to get a schema by name  

Properties

Name Type Description
context Accessor ReadOnly SchemaContext Gets the SchemaContext used by the loader.  

Defined in

Last Updated: 24 June, 2025