SchemaContext Class

The SchemaContext, context object is used to facilitate schema and schema item location.

The context controls the lifetime of each schema that it knows about. It has to be explicitly removed from the context to delete a schema object.

The context is made up of a group of Schema Locators.

Implements

Methods

Name Description
constructor(): SchemaContext    
addLocater(locater: ISchemaLocater): void    
addSchema(schema: Schema): Promise<void> Adds the schema to this context.  
addSchemaItem(schemaItem: SchemaItem): Promise<void> Adds the given SchemaItem to the the SchemaContext by locating the schema, with the best match of SchemaMatchType.Exact, and Deprecated  
addSchemaPromise(schemaInfo: SchemaInfo, schema: Schema, schemaPromise: Promise<Schema>): Promise<void> Adds a promise to load the schema to the cache.  
addSchemaSync(schema: Schema): void Adds the schema to this context  
getKnownSchemas(): Schema[] Gets all the Schemas known by the context.  
getSchema<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchTypeSchemaMatchType.Latest): Promise<undefined | T> Attempts to obtain a schema from this context that matches the specified criteria.  
getSchemaInfo(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType): Promise<undefined | SchemaInfo> Gets the schema info which matches the provided SchemaKey.  
getSchemaItem<T extends SchemaItem>(schemaItemKey: SchemaItemKey): Promise<undefined | T> Gets the schema item from the specified schema if it exists in this SchemaContext.  
getSchemaItems(): IterableIterator<SchemaItem, any, any> Iterates through the items of each schema known to the context.  
getSchemaItemSync<T extends SchemaItem>(schemaItemKey: SchemaItemKey): undefined | T Gets the schema item from the specified schema if it exists in this SchemaContext.  
getSchemaSync<T extends Schema>(schemaKey: SchemaKey, matchType: SchemaMatchTypeSchemaMatchType.Latest): undefined | T Attempts to obtain a schema from this context that matches the specified criteria.  
schemaExists(schemaKey: Readonly<SchemaKey>): boolean Returns true if the schema is already in the context.  

Defined in

Last Updated: 14 November, 2024